On Thu, Jun 26, 2014 at 12:18:25PM +0200, Michal Privoznik wrote:
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
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 :|