libvirt/SOURCES/libvirt-qemu-monitor-Use-target-instead-of-arch-in-reply-of-query-cpus-fast.patch
2021-10-08 13:11:11 +00:00

53 lines
2.1 KiB
Diff

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