6d3351
From 6d2400987412f61857070407a43dc88705cf34f6 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <6d2400987412f61857070407a43dc88705cf34f6@dist-git>
6d3351
From: Jiri Denemark <jdenemar@redhat.com>
6d3351
Date: Wed, 21 Jun 2017 15:31:38 +0200
6d3351
Subject: [PATCH] qemu: Do not skip virCPUUpdateLive if priv->origCPU is set
6d3351
6d3351
Even though we got both the original CPU (used for starting a domain)
6d3351
and the updated version (the CPU really provided by QEMU) during
6d3351
incoming migration, restore, or snapshot revert, we still need to update
6d3351
the CPU according to the data we got from the freshly started QEMU.
6d3351
Otherwise we don't know whether the CPU we got from QEMU matches the one
6d3351
before migration. We just need to keep the original CPU in
6d3351
priv->origCPU.
6d3351
6d3351
Messed up by me in v3.4.0-58-g8e34f4781.
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
(cherry picked from commit eabb0002ca0bba3c5a94d16fb385783de7b144a5)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1441662
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_process.c | 12 ++++--------
6d3351
 1 file changed, 4 insertions(+), 8 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
6d3351
index a7abfc720e..4d7c8d8e40 100644
6d3351
--- a/src/qemu/qemu_process.c
6d3351
+++ b/src/qemu/qemu_process.c
6d3351
@@ -3946,20 +3946,16 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
6d3351
         if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
6d3351
             goto cleanup;
6d3351
 
6d3351
-        /* Don't update the CPU if we already did so when starting a domain
6d3351
-         * during migration, restore or snapshot revert. */
6d3351
-        if (priv->origCPU) {
6d3351
-            ret = 0;
6d3351
-            goto cleanup;
6d3351
-        }
6d3351
-
6d3351
         if (!(orig = virCPUDefCopy(def->cpu)))
6d3351
             goto cleanup;
6d3351
 
6d3351
         if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0) {
6d3351
             goto cleanup;
6d3351
         } else if (rc == 0) {
6d3351
-            if (!virCPUDefIsEqual(def->cpu, orig, false))
6d3351
+            /* Store the original CPU in priv if QEMU changed it and we didn't
6d3351
+             * get the original CPU via migration, restore, or snapshot revert.
6d3351
+             */
6d3351
+            if (!priv->origCPU && !virCPUDefIsEqual(def->cpu, orig, false))
6d3351
                 VIR_STEAL_PTR(priv->origCPU, orig);
6d3351
 
6d3351
             def->cpu->check = VIR_CPU_CHECK_FULL;
6d3351
-- 
6d3351
2.13.1
6d3351