render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c313de
From deeb15a330b987612c8f50df1de8b2acfc2ed703 Mon Sep 17 00:00:00 2001
c313de
Message-Id: <deeb15a330b987612c8f50df1de8b2acfc2ed703@dist-git>
c313de
From: Jiri Denemark <jdenemar@redhat.com>
c313de
Date: Fri, 21 Jun 2019 09:25:05 +0200
c313de
Subject: [PATCH] qemu_capabilities: Use virQEMUCapsGetCPUModelInfo
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
Most places in qemu_capabilities.c which call virQEMUCapsGetHostCPUData
c313de
actually need qemuMonitorCPUModelInfoPtr from QEMU caps. Let's use the
c313de
wrapper introduced in the previous commit instead.
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
(cherry picked from commit 793a9293caabc9876bf7734150ba3acdd85d1649)
c313de
c313de
https://bugzilla.redhat.com/show_bug.cgi?id=1686895
c313de
c313de
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c313de
Message-Id: <6d9804c79ffda5aed3e1ac772b7cc003e930490d.1561068591.git.jdenemar@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 src/qemu/qemu_capabilities.c | 31 ++++++++++++++-----------------
c313de
 1 file changed, 14 insertions(+), 17 deletions(-)
c313de
c313de
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
c313de
index 942cbf272d..851cb73cfc 100644
c313de
--- a/src/qemu/qemu_capabilities.c
c313de
+++ b/src/qemu/qemu_capabilities.c
c313de
@@ -2395,7 +2395,6 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
c313de
     const char *model;
c313de
     qemuMonitorCPUModelExpansionType type;
c313de
     virDomainVirtType virtType;
c313de
-    virQEMUCapsHostCPUDataPtr cpuData;
c313de
     int ret = -1;
c313de
 
c313de
     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
c313de
@@ -2409,8 +2408,6 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
c313de
         model = "host";
c313de
     }
c313de
 
c313de
-    cpuData = virQEMUCapsGetHostCPUData(qemuCaps, virtType);
c313de
-
c313de
     /* Some x86_64 features defined in cpu_map.xml use spelling which differ
c313de
      * from the one preferred by QEMU. Static expansion would give us only the
c313de
      * preferred spelling, thus we need to do a full expansion on the result of
c313de
@@ -2462,7 +2459,8 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
c313de
         modelInfo->migratability = true;
c313de
     }
c313de
 
c313de
-    VIR_STEAL_PTR(cpuData->info, modelInfo);
c313de
+    virQEMUCapsSetCPUModelInfo(qemuCaps, virtType, modelInfo);
c313de
+    modelInfo = NULL;
c313de
     ret = 0;
c313de
 
c313de
  cleanup:
c313de
@@ -2487,24 +2485,24 @@ virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps,
c313de
                           bool migratable,
c313de
                           char ***features)
c313de
 {
c313de
-    virQEMUCapsHostCPUDataPtr data;
c313de
+    qemuMonitorCPUModelInfoPtr modelInfo;
c313de
     char **list;
c313de
     size_t i;
c313de
     size_t n;
c313de
     int ret = -1;
c313de
 
c313de
     *features = NULL;
c313de
-    data = virQEMUCapsGetHostCPUData(qemuCaps, virtType);
c313de
+    modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, virtType);
c313de
 
c313de
-    if (!data->info)
c313de
+    if (!modelInfo)
c313de
         return 0;
c313de
 
c313de
-    if (VIR_ALLOC_N(list, data->info->nprops + 1) < 0)
c313de
+    if (VIR_ALLOC_N(list, modelInfo->nprops + 1) < 0)
c313de
         return -1;
c313de
 
c313de
     n = 0;
c313de
-    for (i = 0; i < data->info->nprops; i++) {
c313de
-        qemuMonitorCPUPropertyPtr prop = data->info->props + i;
c313de
+    for (i = 0; i < modelInfo->nprops; i++) {
c313de
+        qemuMonitorCPUPropertyPtr prop = modelInfo->props + i;
c313de
 
c313de
         if (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO)
c313de
             continue;
c313de
@@ -2514,7 +2512,7 @@ virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps,
c313de
     }
c313de
 
c313de
     VIR_STEAL_PTR(*features, list);
c313de
-    if (migratable && !data->info->migratability)
c313de
+    if (migratable && !modelInfo->migratability)
c313de
         ret = 1;
c313de
     else
c313de
         ret = 0;
c313de
@@ -2915,17 +2913,17 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
c313de
                         virCPUDefPtr cpu,
c313de
                         bool migratable)
c313de
 {
c313de
-    virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type);
c313de
+    qemuMonitorCPUModelInfoPtr modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, type);
c313de
     int ret = 1;
c313de
 
c313de
-    if (migratable && cpuData->info && !cpuData->info->migratability)
c313de
+    if (migratable && modelInfo && !modelInfo->migratability)
c313de
         return 1;
c313de
 
c313de
     if (ARCH_IS_S390(qemuCaps->arch)) {
c313de
-        ret = virQEMUCapsInitCPUModelS390(qemuCaps, type, cpuData->info,
c313de
+        ret = virQEMUCapsInitCPUModelS390(qemuCaps, type, modelInfo,
c313de
                                           cpu, migratable);
c313de
     } else if (ARCH_IS_X86(qemuCaps->arch)) {
c313de
-        ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, cpuData->info,
c313de
+        ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, modelInfo,
c313de
                                          cpu, migratable);
c313de
     }
c313de
 
c313de
@@ -3655,8 +3653,7 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
c313de
                                   virBufferPtr buf,
c313de
                                   virDomainVirtType type)
c313de
 {
c313de
-    virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type);
c313de
-    qemuMonitorCPUModelInfoPtr model = cpuData->info;
c313de
+    qemuMonitorCPUModelInfoPtr model = virQEMUCapsGetCPUModelInfo(qemuCaps, type);
c313de
     const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg";
c313de
     size_t i;
c313de
 
c313de
-- 
c313de
2.22.0
c313de