render / rpms / libvirt

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