Re: [PATCH RFC 1/4] Introduce domain_capabilities

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

 



On Thu, Jun 26, 2014 at 12:18:25PM +0200, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/Makefile.am                |   1 +
>  src/conf/domain_capabilities.c | 217 +++++++++++++++++++++++++++++++++++++++++
>  src/conf/domain_capabilities.h |  89 +++++++++++++++++
>  src/libvirt_private.syms       |   5 +
>  4 files changed, 312 insertions(+)
>  create mode 100644 src/conf/domain_capabilities.c
>  create mode 100644 src/conf/domain_capabilities.h
> +static int
> +virDomainCapsFormatInternal(virBufferPtr buf,
> +                            virDomainCapsPtr const caps)
> +{
> +    const char *virttype_str = virDomainVirtTypeToString(caps->virttype);
> +    const char *arch_str = virArchToString(caps->arch);
> +
> +    virBufferAddLit(buf, "<emulatorCapabilities>\n");

s/emulator/domain/

> +    virBufferAdjustIndent(buf, 2);
> +
> +    virBufferAsprintf(buf, "<path>%s</path>\n", caps->path);
> +    virBufferAsprintf(buf, "<domain>%s</domain>\n", virttype_str);
> +    virBufferAsprintf(buf, "<machine>%s</machine>\n", caps->machine);
> +    virBufferAsprintf(buf, "<arch>%s</arch>\n", arch_str);
> +
> +    if (caps->maxvcpus)
> +        virBufferAsprintf(buf, "<vcpu>%d</vcpu>\n", caps->maxvcpus);

I might suggest using max='%d' so if we need to expose more info
about vcpus in future we can still have child elements

> +
> +    virBufferAddLit(buf, "<devices>\n");
> +    virBufferAdjustIndent(buf, 2);
> +
> +    virDomainCapsDeviceDiskFormat(buf, &caps->disk);
> +    virDomainCapsDeviceHostdevFormat(buf, &caps->hostdev);
> +
> +    virBufferAdjustIndent(buf, -2);
> +    virBufferAddLit(buf, "</devices>\n");
> +
> +    virBufferAdjustIndent(buf, -2);
> +    virBufferAddLit(buf, "</emulatorCapabilities>\n");
> +    return 0;
> +}

Basically this looks sane to me.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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