Re: [PATCH 4/6] normalize_xml: New internal API to format device XML

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

 



On 01/09/2012 07:29 AM, Osier Yang wrote:
> ---

More details in the commit message might be nice.

>  src/conf/domain_conf.c   |   70 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_conf.h   |    2 +
>  src/libvirt_private.syms |    1 +
>  3 files changed, 73 insertions(+), 0 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 0190a81..f0ed479 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11832,6 +11832,76 @@ virDomainDefFormat(virDomainDefPtr def, unsigned int flags)
>      return virBufferContentAndReset(&buf);
>  }
>  
> +char *
> +virDomainDeviceDefFormat(virDomainDeviceDefPtr dev, unsigned int flags)
> +{
> +    virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> +    virCheckFlags(DUMPXML_FLAGS, NULL);
> +
> +    switch(dev->type) {
> +        case VIR_DOMAIN_DEVICE_DISK:
> +            if (virDomainDiskDefFormat(&buf, dev->data.disk, flags) < 0)
> +                goto cleanup;
> +            break;
> +        case VIR_DOMAIN_DEVICE_LEASE:
> +            if (virDomainLeaseDefFormat(&buf, dev->data.lease) < 0)
> +                goto cleanup;
> +            break;

ACK - this looks like a useful helper method for implementing _part_ of
the new functionality.  But if you make things more generic, you
probably also want a helper function at a higher level that delegates
between domain_conf.c, interface_conf.c, and so forth, all according to
the type parameter tied to the XML being normalized.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
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]