[libvirt] [PATCH] qemu: capabilities detection for 0.15 through 1.1

Doug Goldstein cardoe at cardoe.com
Thu Nov 1 23:55:47 UTC 2012


With the introduction of the new capabilities storage relying on QMP we
lost some insight into features available between 0.15 and 1.1. We use
QMP on these versions but only when we go to start the actual guest
rather than for querying up front. The issue is help scraping isn't an
exact science while QMP is an exact science. The issue with the existing
approach of checking QMP on startup is that if the command is really not
there, then we never clear the bit.

An example of this being a problem in on Ubuntu 12.04 LTS where the
default qemu-kvm package does not include SPICE support but -help claims
that it does (because -help always advertises SPICE support). So the
user does not get to see our helpful message when they attempt to start
up a SPICE based domain without having SPICE support.
---

Really hoping a Ubuntu 12.04 user or Ubuntu developer can test this out and
see if this remedies the issue. There's a long list of issues opened on
Launchpad with this bug. I believe where this fix really remedies
things for people is when they're using -vga std instead of -vga qxl. Due to
the fact that qxl will have a spicevmc device that just won't work so they'll
at least get notification that way. -vga std will result in no message and
the domain not working.

---
 src/qemu/qemu_capabilities.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 271273c..37b50c1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1871,6 +1871,21 @@ qemuCapsProbeQMPCommands(qemuCapsPtr caps,
     if ((ncommands = qemuMonitorGetCommands(mon, &commands)) < 0)
         return -1;
 
+    /* We want to clear these capabilities out so we can properly
+     * detect them. Otherwise if they're already set and we don't
+     * detect them, the bit won't clear.
+     */
+    qemuCapsClear(caps, QEMU_CAPS_WAKEUP);
+    qemuCapsClear(caps, QEMU_CAPS_TRANSACTION);
+    qemuCapsClear(caps, QEMU_CAPS_BLOCKJOB_SYNC);
+    qemuCapsClear(caps, QEMU_CAPS_BLOCKJOB_ASYNC);
+    qemuCapsClear(caps, QEMU_CAPS_DUMP_GUEST_MEMORY);
+    qemuCapsClear(caps, QEMU_CAPS_SPICE);
+    qemuCapsClear(caps, QEMU_CAPS_KVM);
+    qemuCapsClear(caps, QEMU_CAPS_VNC);
+    qemuCapsClear(caps, QEMU_CAPS_BLOCK_COMMIT);
+    qemuCapsClear(caps, QEMU_CAPS_DRIVE_MIRROR);
+
     for (i = 0 ; i < ncommands ; i++) {
         char *name = commands[i];
         if (STREQ(name, "system_wakeup"))
@@ -1909,6 +1924,13 @@ qemuCapsProbeQMPEvents(qemuCapsPtr caps,
     int nevents;
     size_t i;
 
+    /* We want to clear these capabilities out so we can properly
+     * detect them. Otherwise if they're already set and we don't
+     * detect them, the bit won't clear.
+     */
+    qemuCapsClear(caps, QEMU_CAPS_BALLOON_EVENT);
+    qemuCapsClear(caps, QEMU_CAPS_SEAMLESS_MIGRATION);
+
     if ((nevents = qemuMonitorGetEvents(mon, &events)) < 0)
         return -1;
 
-- 
1.7.8.6




More information about the libvir-list mailing list