xencreate : What is the error with my program ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I am getting this error on trying to create a xen
domain
Unable to create domain .
This is the code snippet. I am unable to figure out
the root cause .
Any help will be appreciated ..
Thanks,
Dakshina
/* XML descriptor to create a new Domain */

const char *xmlDesc="<domain type='xen' id='18'
><name>newxen</name> <os><type>linux</type> <kernel>
/boot/vmlinuz-2.6.12-xenU </kernel>
<root>/dev/hda5</root><cmdline>3</cmdline></os><memory>65536</memory><vcpu>1</vcpu><devices><disk
type='file'><source file='/copyfed.img'/>
</disk></devices></domain>";

static void createNewDomain(){
    virConnectPtr conn = NULL; /* the hypervisor
connection */
    virDomainPtr dom = NULL;   /* the domain being
checked */
    virDomainInfo info;        /* the informations
being fetched */
    virErrorPtr err;      /* Ptr to the error
structure*/
    int errorCode;

    char xmlDesc[250];
    unsigned int flags=0;

    /* NULL means connect to local Xen hypervisor */
    conn = virConnectOpenReadOnly(NULL);
    if (conn == NULL) {
        fprintf(stderr, "Failed to connect to
hypervisor\n");
        goto error;
    }
    printf("Connected to the hypervisor
successfully");

    dom=virDomainCreateLinux(conn,xmlDesc,0);
    if (dom == NULL) {
        fprintf(stderr,"Unable to create a domain\n");
        goto error;
    }


    dom = virDomainLookupByID(conn, 0);
    printf(" %s\n" ,virDomainGetXMLDesc(dom,0));


error:
    #if 0
        err=virGetLastError();
        printf("Error is %s\n" ,err->message);
    #endif

    errorCode=virConnCopyLastError(conn,err);
    printf("Error is %d\n" ,errorCode);

    if (dom != NULL)
        virDomainFree(dom);
    if (conn != NULL)
        virConnectClose(conn);

}


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]