[libvirt] [PATCH 1/2] Addition of XenAPI support to libvirt

Matthias Bolte matthias.bolte at googlemail.com
Fri Feb 26 20:46:02 UTC 2010


2010/2/26 Matthias Bolte <matthias.bolte at googlemail.com>:
> 2010/2/26 Sharadha Prabhakar (3P) <sharadha.prabhakar at citrix.com>:
>> This patch contains XenAPI driver specific files.
>> Files included are
>> xenapi_driver.c
>> xenapi_utils.c
>> xenapi_driver.h
>> xenapi_driver_private.h
>> xenapi_utils.h
>> This patch includes changes suggested in the first review.
>>
>>

>> +/*
>> +* xenapiDomainLookupByUUID
>> +*
>> +* Returns the domain pointer of domain with matching UUID
>> +* or -1 in case of error
>> +*/
>> +static virDomainPtr
>> +xenapiDomainLookupByUUID (virConnectPtr conn,
>> +                          const unsigned char *uuid)
>> +{
>> +    /* vm.get_by_uuid */
>> +    xen_vm vm;
>> +    xen_vm_record *record;
>> +    unsigned char raw_uuid[VIR_UUID_BUFLEN];
>> +    virDomainPtr domP=NULL;
>> +    xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
>> +    if (xen_vm_get_by_uuid(session, &vm, (char *)uuid)) {
>> +        xen_vm_get_record(session, &record, vm);
>> +        if (record != NULL) {
>> +            virUUIDParse((char *)uuid,raw_uuid);
>
> const unsigned char *uuid is already in raw format. Parsing it again
> will give wrong results. Did you actually test this function?
>

Okay, I take this one back. You use the domain name for lookup in
other functions, so a broken UUID may not surface in manual tests.

Matthias




More information about the libvir-list mailing list