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

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



On 07/13/2011 07:04 AM, Matthias Bolte wrote:
> 2011/7/8 Eric Blake <eblake redhat com>:
>> * 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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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