[libvirt] [PATCHv3 1/6] flags: use common dumpxml flags check

Matthias Bolte matthias.bolte at googlemail.com
Fri Jul 15 15:25:35 UTC 2011


2011/7/15 Eric Blake <eblake at redhat.com>:
> The previous patches only cleaned up ATTRIBUTE_UNUSED flags cases;
> auditing the drivers found other places where flags was being used
> but not validated.  In particular, domainGetXMLDesc had issues with
> clients accepting a different set of flags than the common
> virDomainDefFormat helper function.
>
> * src/conf/domain_conf.c (virDomainDefFormat): Add common flag check.
> * src/storage/storage_driver.c (storageVolumeCreateXMLFrom): Pass
> 0 to drivers, since all flags are currently rejected.
> * src/uml/uml_driver.c (umlDomainAttachDeviceFlags)
> (umlDomainDetachDeviceFlags): Reject unknown
> flags.
> * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc)
> (vboxDomainAttachDeviceFlags)
> (vboxDomainDetachDeviceFlags): Likewise.
> * src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Likewise.
> (qemuDomainGetXMLDesc): Document common flag handling.
> * src/libxl/libxl_driver.c (libxlDomainGetXMLDesc): Likewise.
> * src/lxc/lxc_driver.c (lxcDomainGetXMLDesc): Likewise.
> * src/openvz/openvz_driver.c (openvzDomainGetXMLDesc): Likewise.
> * src/phyp/phyp_driver.c (phypDomainGetXMLDesc): Likewise.
> * src/test/test_driver.c (testDomainGetXMLDesc): Likewise.
> * src/vmware/vmware_driver.c (vmwareDomainGetXMLDesc): Likewise.
> * src/xenapi/xenapi_driver.c (xenapiDomainGetXMLDesc): Likewise.
> ---

> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
> index 4f35be0..419df42 100644
> --- a/src/storage/storage_driver.c
> +++ b/src/storage/storage_driver.c
> @@ -1522,7 +1522,7 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
>         virStoragePoolObjUnlock(origpool);
>     }
>
> -    buildret = backend->buildVolFrom(obj->conn, pool, newvol, origvol, flags);
> +    buildret = backend->buildVolFrom(obj->conn, pool, newvol, origvol, 0);
>
>     storageDriverLock(driver);
>     virStoragePoolObjLock(pool);

I don't think that this is a good idea. Even if the function doesn't
have any flags at the moment this change will give us trouble when
someone want's to add a flag to virStorageVolCreateXMLFrom that should
have been passed down to the backend's buildVolFrom function.

ACK, to a patch without this hunk.

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list