[PATCH 4/4] Ignore error from query-cpu-definitions

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Some architectures provide the query-cpu-definitions command,
but are set to always return a "GenericError" from it :-(
Catch this & treat it as if there was an empty list of CPUs
returned

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c |  2 +-
 src/qemu/qemu_monitor.c      |  1 -
 src/qemu/qemu_monitor_json.c | 12 ++++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 682d3e6..2ae6fec 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2240,7 +2240,7 @@ qemuCapsInitQMP(qemuCapsPtr caps)
     VIR_DEBUG("Got version %d.%d.%d (%s)",
               major, minor, micro, NULLSTR(package));
 
-    if (!(major >= 1 && minor >= 1 && micro >= 90)) {
+    if (!(major >= 1 || (major == 1 && minor >= 1))) {
         VIR_DEBUG("Not new enough for QMP capabilities detection");
         ret = 0;
         goto cleanup;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6c3f09e..85b0bc2 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -843,7 +843,6 @@ void qemuMonitorClose(qemuMonitorPtr mon)
             mon->watch = 0;
         }
         VIR_FORCE_CLOSE(mon->fd);
-        fprintf(stderr, "Closing monitr\n");
     }
 
     /* In case another thread is waiting for its monitor command to be
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 166c431..bd52ce4 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3957,6 +3957,18 @@ int qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
 
     ret = qemuMonitorJSONCommand(mon, cmd, &reply);
 
+    if (ret == 0) {
+        /* Urgh, some QEMU architectures have the query-cpu-definitions
+         * command, but return 'GenericError' with string "Not supported",
+         * instead of simply omitting the command entirely :-(
+         */
+        if (qemuMonitorJSONHasError(reply, "GenericError")) {
+            ret = 0;
+            goto cleanup;
+        }
+        ret = qemuMonitorJSONCheckError(cmd, reply);
+    }
+
     if (ret == 0)
         ret = qemuMonitorJSONCheckError(cmd, reply);
 
-- 
1.7.11.4

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