render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
edecca
From d801cf83a1f453f034147e83bce0c9665d911c26 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <d801cf83a1f453f034147e83bce0c9665d911c26@dist-git>
edecca
From: Peter Krempa <pkrempa@redhat.com>
edecca
Date: Tue, 4 Sep 2018 16:41:31 +0200
edecca
Subject: [PATCH] qemu: monitor: Use 'target' instead of 'arch' in reply of
edecca
 'query-cpus-fast'
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
qemu changed the output field name for the architecture from 'arch' to
edecca
'target'. Note the change and fix the code so that the arch-specific
edecca
extraction works.
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1598829
edecca
edecca
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
edecca
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
edecca
(cherry picked from commit 902f4bce098d68c48899fc1c42ec1552f2104995)
edecca
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1598829
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 src/qemu/qemu_monitor_json.c | 6 +++++-
edecca
 1 file changed, 5 insertions(+), 1 deletion(-)
edecca
edecca
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
edecca
index e7e6658075..d6c11666c5 100644
edecca
--- a/src/qemu/qemu_monitor_json.c
edecca
+++ b/src/qemu/qemu_monitor_json.c
edecca
@@ -1647,6 +1647,9 @@ qemuMonitorJSONExtractCPUS390Info(virJSONValuePtr jsoncpu,
edecca
  *    ...},
edecca
  *    {...}
edecca
  *  ]
edecca
+ *
edecca
+ *  Note that since QEMU 2.13.0 the "arch" output member of the
edecca
+ *  "query-cpus-fast" command is replaced by "target".
edecca
  */
edecca
 static int
edecca
 qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
edecca
@@ -1682,7 +1685,8 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
edecca
          * The return data of query-cpus-fast has different field names
edecca
          */
edecca
         if (fast) {
edecca
-            arch = virJSONValueObjectGetString(entry, "arch");
edecca
+            if (!(arch = virJSONValueObjectGetString(entry, "target")))
edecca
+                arch = virJSONValueObjectGetString(entry, "arch");
edecca
             ignore_value(virJSONValueObjectGetNumberInt(entry, "cpu-index", &cpuid));
edecca
             ignore_value(virJSONValueObjectGetNumberInt(entry, "thread-id", &thread));
edecca
             qom_path = virJSONValueObjectGetString(entry, "qom-path");
edecca
-- 
edecca
2.18.0
edecca