[libvirt] [PATCH] qemu: Do not skip virCPUUpdateLive if priv->origCPU is set

Jiri Denemark posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/7e78b7e96897ebf76856d33f4a3b856ac620919d.1498053644.git.jdenemar@redhat.com
src/qemu/qemu_process.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
[libvirt] [PATCH] qemu: Do not skip virCPUUpdateLive if priv->origCPU is set
Posted by Jiri Denemark 6 years, 10 months ago
Even though we got both the original CPU (used for starting a domain)
and the updated version (the CPU really provided by QEMU) during
incoming migration, restore, or snapshot revert, we still need to update
the CPU according to the data we got from the freshly started QEMU.
Otherwise we don't know whether the CPU we got from QEMU matches the one
before migration. We just need to keep the original CPU in
priv->origCPU.

Messed up by me in v3.4.0-58-g8e34f4781.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_process.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 63119396b..d669dfb32 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3989,20 +3989,16 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
         if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
             goto cleanup;
 
-        /* Don't update the CPU if we already did so when starting a domain
-         * during migration, restore or snapshot revert. */
-        if (priv->origCPU) {
-            ret = 0;
-            goto cleanup;
-        }
-
         if (!(orig = virCPUDefCopy(def->cpu)))
             goto cleanup;
 
         if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0) {
             goto cleanup;
         } else if (rc == 0) {
-            if (!virCPUDefIsEqual(def->cpu, orig, false))
+            /* Store the original CPU in priv if QEMU changed it and we didn't
+             * get the original CPU via migration, restore, or snapshot revert.
+             */
+            if (!priv->origCPU && !virCPUDefIsEqual(def->cpu, orig, false))
                 VIR_STEAL_PTR(priv->origCPU, orig);
 
             def->cpu->check = VIR_CPU_CHECK_FULL;
-- 
2.13.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Do not skip virCPUUpdateLive if priv->origCPU is set
Posted by Pavel Hrdina 6 years, 10 months ago
On Wed, Jun 21, 2017 at 04:00:44PM +0200, Jiri Denemark wrote:
> Even though we got both the original CPU (used for starting a domain)
> and the updated version (the CPU really provided by QEMU) during
> incoming migration, restore, or snapshot revert, we still need to update
> the CPU according to the data we got from the freshly started QEMU.
> Otherwise we don't know whether the CPU we got from QEMU matches the one
> before migration. We just need to keep the original CPU in
> priv->origCPU.
> 
> Messed up by me in v3.4.0-58-g8e34f4781.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/qemu/qemu_process.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list