render / rpms / libvirt

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