On Thu, Oct 17, 2013 at 03:10:17PM +0200, Peter Krempa wrote:
From: Jiri Denemark <jdenemar(a)redhat.com>
The qemu monitor supports retrieval of actual CPUID bits presented to
the guest using QMP monitor. Add APIs to extract these information and
tests for them.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
+/**
+ * qemuMonitorJSONGetGuestCPU:
+ * @mon: Pointer to the monitor
+ * @arch: arch of the guest
+ * @cpuData: Returned cpu definition of the gues
+ *
+ * Retrieve the definition of the guest CPU from a running qemu instance.
+ *
+ * Returns 0 on success; -1 on error; -2 if error may be caused by qemu not
+ * supporting reporting of CPU definition.
I'm not convinced we need the '-2' case here - I'd wrap it into the
regular '-1' case. I'll point out why in patch 8.
+ */
+int
+qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon,
+ virArch arch,
+ virCPUDataPtr *cpuData)
+{
+ *cpuData = NULL;
+
+ switch (arch) {
+ case VIR_ARCH_X86_64:
+ case VIR_ARCH_I686:
+ return qemuMonitorJSONGetCPUx86Data(mon, "feature-words", cpuData);
+
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU definition retrieval insn't supported for
'%s'"),
s/insn't/isn't/
+ virArchToString(arch));
+ return -2;
+ }
+}
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 :|