libvirt/SOURCES/libvirt-qemu-monitor-Remove...

89 lines
3.3 KiB
Diff

From a66c293aea0e989807b2a7850e597bf9514856d8 Mon Sep 17 00:00:00 2001
Message-Id: <a66c293aea0e989807b2a7850e597bf9514856d8@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Sep 2018 16:41:30 +0200
Subject: [PATCH] qemu: monitor: Remove qemuMonitorJSONExtractCPUArchInfo
wrapper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The wraper is quite pointless and also the 'arch' field may depend on
whether query-cpus-fast is used.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 1e65d35b047959af7a033aad4cc364e4cf87b17b)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1598829
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_monitor_json.c | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8199556166..e7e6658075 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1603,27 +1603,6 @@ qemuMonitorJSONExtractCPUS390Info(virJSONValuePtr jsoncpu,
}
-/**
- * qemuMonitorJSONExtractCPUArchInfo:
- * @jsoncpu: pointer to a single JSON cpu entry
- * @cpu: pointer to a single cpu entry
- *
- * Extracts architecure specific virtual CPU data for a single
- * CPU from the QAPI response using an architecture specific
- * function.
- *
- */
-static void
-qemuMonitorJSONExtractCPUArchInfo(virJSONValuePtr jsoncpu,
- struct qemuMonitorQueryCpusEntry *cpu)
-{
- const char *arch = virJSONValueObjectGetString(jsoncpu, "arch");
-
- if (STREQ_NULLABLE(arch, "s390"))
- qemuMonitorJSONExtractCPUS390Info(jsoncpu, cpu);
-}
-
-
/**
* qemuMonitorJSONExtractCPUInfo:
* @data: JSON response data
@@ -1675,6 +1654,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
size_t *nentries,
bool fast)
{
+ const char *arch = NULL;
struct qemuMonitorQueryCpusEntry *cpus = NULL;
int ret = -1;
size_t i;
@@ -1702,10 +1682,12 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
* The return data of query-cpus-fast has different field names
*/
if (fast) {
+ arch = virJSONValueObjectGetString(entry, "arch");
ignore_value(virJSONValueObjectGetNumberInt(entry, "cpu-index", &cpuid));
ignore_value(virJSONValueObjectGetNumberInt(entry, "thread-id", &thread));
qom_path = virJSONValueObjectGetString(entry, "qom-path");
} else {
+ arch = virJSONValueObjectGetString(entry, "arch");
ignore_value(virJSONValueObjectGetNumberInt(entry, "CPU", &cpuid));
ignore_value(virJSONValueObjectGetNumberInt(entry, "thread_id", &thread));
ignore_value(virJSONValueObjectGetBoolean(entry, "halted", &halted));
@@ -1719,7 +1701,8 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr data,
goto cleanup;
/* process optional architecture-specific data */
- qemuMonitorJSONExtractCPUArchInfo(entry, cpus + i);
+ if (STREQ_NULLABLE(arch, "s390"))
+ qemuMonitorJSONExtractCPUS390Info(entry, cpus + i);
}
VIR_STEAL_PTR(*entries, cpus);
--
2.18.0