Re: [PATCHv2 19/27] xenapi: reject unknown flags

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

 



On 07/13/2011 07:04 AM, Matthias Bolte wrote:
> 2011/7/8 Eric Blake <eblake@xxxxxxxxxx>:
>> * src/xenapi/xenapi_driver.c (xenapiOpen, xenapiDomainReboot)
>> (xenapiDomainGetXMLDesc): Reject unknown flags.
>> ---
>>  src/xenapi/xenapi_driver.c |   13 ++++++++++---
>>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
>> @@ -1309,6 +1314,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
>>     struct xen_vif_set *vif_set = NULL;
>>     char *xml;
>>
>> +    virCheckFlags(0, NULL);
>> +
>>     if (!xen_vm_get_by_name_label(session, &vms, dom->name)) return NULL;
>>     if (vms->size != 1) {
>>         xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
> 
> You found a bug, but made it worse instead of fixing it.
> xenapiDomainGetXMLDesc should pass the flags to virDomainDefFormat
> instead of passing 0.
> 
> ACK, with passing flags to virDomainDefFormat instead of ignoring it.

Pushed with this squashed in:

diff --git i/src/xenapi/xenapi_driver.c w/src/xenapi/xenapi_driver.c
index 5d5e810..aa616ca 100644
--- i/src/xenapi/xenapi_driver.c
+++ w/src/xenapi/xenapi_driver.c
@@ -1316,7 +1316,9 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned
int flags)
     struct xen_vif_set *vif_set = NULL;
     char *xml;

-    virCheckFlags(0, NULL);
+    virCheckFlags(VIR_DOMAIN_XML_SECURE |
+                  VIR_DOMAIN_XML_INACTIVE |
+                  VIR_DOMAIN_XML_UPDATE_CPU, NULL);

     if (!xen_vm_get_by_name_label(session, &vms, dom->name)) return NULL;
     if (vms->size != 1) {
@@ -1483,7 +1485,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned
int flags)
         xen_vif_set_free(vif_set);
     }
     if (vms) xen_vm_set_free(vms);
-    xml = virDomainDefFormat(defPtr, 0);
+    xml = virDomainDefFormat(defPtr, flags);
     virDomainDefFree(defPtr);
     return xml;



-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]