[Libvir] xencreate : What is the error with my program ?

dasari dakshina dakshi80 at yahoo.com
Mon Jul 3 09:06:30 UTC 2006


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 




More information about the libvir-list mailing list