render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 22376689ed26a2bba1c8a9fa328a046eee0da4c4 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <22376689ed26a2bba1c8a9fa328a046eee0da4c4@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Tue, 11 Aug 2015 17:16:00 +0200
7a3408
Subject: [PATCH] cpu: Never skip CPU model name check in ppc64 driver
7a3408
7a3408
ppc64Compute(), called by cpuNodeData(), is used not only to retrieve
7a3408
the driver-specific data associated to a guest CPU definition, but
7a3408
also to check whether said guest CPU is compatible with the host CPU.
7a3408
7a3408
If the user is not interested in the CPU data, it's perfectly fine
7a3408
to pass a NULL pointer instead of a return location, and the
7a3408
compatibility data returned should not be affected by this. One of
7a3408
the checks, specifically the one on CPU model name, was however
7a3408
only performed if the return location was non-NULL.
7a3408
7a3408
(cherry picked from commit 8382136d42fd2caf2e5c7ad3b579f4fc5f104533)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/cpu/cpu_ppc64.c | 31 +++++++++++++++----------------
7a3408
 1 file changed, 15 insertions(+), 16 deletions(-)
7a3408
7a3408
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
7a3408
index 5921263..53d8fb0 100644
7a3408
--- a/src/cpu/cpu_ppc64.c
7a3408
+++ b/src/cpu/cpu_ppc64.c
7a3408
@@ -407,26 +407,25 @@ ppc64Compute(virCPUDefPtr host,
7a3408
         !(guest_model = ppc64ModelFromCPU(cpu, map)))
7a3408
         goto cleanup;
7a3408
 
7a3408
-    if (guestData) {
7a3408
-        if (cpu->type == VIR_CPU_TYPE_GUEST &&
7a3408
-            cpu->match == VIR_CPU_MATCH_STRICT &&
7a3408
-            STRNEQ(guest_model->name, host_model->name)) {
7a3408
-            VIR_DEBUG("host CPU model does not match required CPU model %s",
7a3408
-                      guest_model->name);
7a3408
-            if (message &&
7a3408
-                virAsprintf(message,
7a3408
-                            _("host CPU model does not match required "
7a3408
-                            "CPU model %s"),
7a3408
-                            guest_model->name) < 0)
7a3408
-                goto cleanup;
7a3408
-
7a3408
-            ret = VIR_CPU_COMPARE_INCOMPATIBLE;
7a3408
+    if (cpu->type == VIR_CPU_TYPE_GUEST &&
7a3408
+        cpu->match == VIR_CPU_MATCH_STRICT &&
7a3408
+        STRNEQ(guest_model->name, host_model->name)) {
7a3408
+        VIR_DEBUG("host CPU model does not match required CPU model %s",
7a3408
+                  guest_model->name);
7a3408
+        if (message &&
7a3408
+            virAsprintf(message,
7a3408
+                        _("host CPU model does not match required "
7a3408
+                        "CPU model %s"),
7a3408
+                        guest_model->name) < 0)
7a3408
             goto cleanup;
7a3408
-        }
7a3408
 
7a3408
+        ret = VIR_CPU_COMPARE_INCOMPATIBLE;
7a3408
+        goto cleanup;
7a3408
+    }
7a3408
+
7a3408
+    if (guestData)
7a3408
         if (!(*guestData = ppc64MakeCPUData(arch, &guest_model->data)))
7a3408
             goto cleanup;
7a3408
-    }
7a3408
 
7a3408
     ret = VIR_CPU_COMPARE_IDENTICAL;
7a3408
 
7a3408
-- 
7a3408
2.5.0
7a3408