Blame SOURCES/libvirt-qemu-Move-common-code-in-virQEMUCapsInitCPUModel-one-layer-up.patch

3e5111
From 739fd2eac238497276f752689a7e619e298cb746 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <739fd2eac238497276f752689a7e619e298cb746@dist-git>
3e5111
From: Jiri Denemark <jdenemar@redhat.com>
3e5111
Date: Thu, 30 Mar 2017 13:50:44 +0200
3e5111
Subject: [PATCH] qemu: Move common code in virQEMUCapsInitCPUModel one layer
3e5111
 up
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
(cherry picked from commit d84b93fad51b190238e18b1daac82ea6e28869e9)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1444421
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_capabilities.c | 25 ++++++++++---------------
3e5111
 1 file changed, 10 insertions(+), 15 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
3e5111
index 2c845853a..b71de9633 100644
3e5111
--- a/src/qemu/qemu_capabilities.c
3e5111
+++ b/src/qemu/qemu_capabilities.c
3e5111
@@ -3117,17 +3117,11 @@ virQEMUCapsCPUFilterFeatures(const char *name,
3e5111
  */
3e5111
 static int
3e5111
 virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
3e5111
-                            virDomainVirtType type,
3e5111
+                            qemuMonitorCPUModelInfoPtr modelInfo,
3e5111
                             virCPUDefPtr cpu)
3e5111
 {
3e5111
-    qemuMonitorCPUModelInfoPtr modelInfo;
3e5111
     size_t i;
3e5111
 
3e5111
-    if (type == VIR_DOMAIN_VIRT_KVM)
3e5111
-        modelInfo = qemuCaps->kvmCPUModelInfo;
3e5111
-    else
3e5111
-        modelInfo = qemuCaps->tcgCPUModelInfo;
3e5111
-
3e5111
     if (!modelInfo) {
3e5111
         virReportError(VIR_ERR_INTERNAL_ERROR,
3e5111
                        _("missing host CPU model info from QEMU capabilities "
3e5111
@@ -3169,9 +3163,9 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
3e5111
 static int
3e5111
 virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
3e5111
                            virDomainVirtType type,
3e5111
+                           qemuMonitorCPUModelInfoPtr model,
3e5111
                            virCPUDefPtr cpu)
3e5111
 {
3e5111
-    qemuMonitorCPUModelInfoPtr model;
3e5111
     virCPUDataPtr data = NULL;
3e5111
     unsigned long long sigFamily = 0;
3e5111
     unsigned long long sigModel = 0;
3e5111
@@ -3180,11 +3174,6 @@ virQEMUCapsInitCPUModelX86(virQEMUCapsPtr qemuCaps,
3e5111
     int ret = -1;
3e5111
     size_t i;
3e5111
 
3e5111
-    if (type == VIR_DOMAIN_VIRT_KVM)
3e5111
-        model = qemuCaps->kvmCPUModelInfo;
3e5111
-    else
3e5111
-        model = qemuCaps->tcgCPUModelInfo;
3e5111
-
3e5111
     if (!model)
3e5111
         return 1;
3e5111
 
3e5111
@@ -3245,12 +3234,18 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
3e5111
                         virDomainVirtType type,
3e5111
                         virCPUDefPtr cpu)
3e5111
 {
3e5111
+    qemuMonitorCPUModelInfoPtr model;
3e5111
     int ret = 1;
3e5111
 
3e5111
+    if (type == VIR_DOMAIN_VIRT_KVM)
3e5111
+        model = qemuCaps->kvmCPUModelInfo;
3e5111
+    else
3e5111
+        model = qemuCaps->tcgCPUModelInfo;
3e5111
+
3e5111
     if (ARCH_IS_S390(qemuCaps->arch))
3e5111
-        ret = virQEMUCapsInitCPUModelS390(qemuCaps, type, cpu);
3e5111
+        ret = virQEMUCapsInitCPUModelS390(qemuCaps, model, cpu);
3e5111
     else if (ARCH_IS_X86(qemuCaps->arch))
3e5111
-        ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, cpu);
3e5111
+        ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, model, cpu);
3e5111
 
3e5111
     if (ret == 0)
3e5111
         cpu->fallback = VIR_CPU_FALLBACK_FORBID;
3e5111
-- 
3e5111
2.12.2
3e5111