[libvirt] [PATCH 09/11] Pull parsing of migration xml up into QEMU driver APIs

Eric Blake eblake at redhat.com
Fri May 3 16:30:19 UTC 2013


On 05/02/2013 06:03 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Currently the parsing of XML is pushed down into the various
> migration helper APIs. This makes it difficult to insert the
> correct access control checks, since one helper API services
> many public APIs. Pull the parsing of XML up to the top level
> of the QEMU driver APIs
> ---
>  src/qemu/qemu_driver.c    | 92 ++++++++++++++++++++++++++++++++++++++++++++---
>  src/qemu/qemu_migration.c | 35 +++++-------------
>  src/qemu/qemu_migration.h |  6 ++--
>  3 files changed, 99 insertions(+), 34 deletions(-)

ACK.

>  
> +    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
> +        goto cleanup;
> +
> +    if (!(def = virDomainDefParseString(dom_xml, caps, driver->xmlopt,
> +                                        QEMU_EXPECTED_VIRT_TYPES,
> +                                        VIR_DOMAIN_XML_INACTIVE)))
> +        goto cleanup;
> +
> +    if (dname) {
> +        VIR_FREE(def->name);
> +        if (!(def->name = strdup(dname))) {
> +            virReportOOMError();
> +            goto cleanup;
> +        }
> +    }

This section is repeated a bit; is it worth further factoring it into a
helper function to be called from each site?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130503/231f1167/attachment-0001.sig>


More information about the libvir-list mailing list