]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Do not set //cpu/@migratable for running domains in post-parse
authorJiri Denemark <jdenemar@redhat.com>
Wed, 15 Jul 2020 09:33:05 +0000 (11:33 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 21 Jul 2020 13:40:01 +0000 (15:40 +0200)
Commit v6.4.0-61-g201bd5db63 started to fill the default value for
//cpu/@migratable attribute according to QEMU support. However, active
domains either have the migratable attribute already set or the
capabilities we use for checking the QEMU support were created by older
libvirt which didn't probe for this specific capability. Thus we should
leave active domains alone when parsing their XMLs.

https://bugzilla.redhat.com/show_bug.cgi?id=1857967

Reported-by: Mark Mielke <mark.mielke@gmail.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_domain.c

index 1a48a9aa5b2defaa26bc885b2773ef61fc7ba29c..5b22eb2eaa935302abaebab5d3f7fb5511c3d65e 100644 (file)
@@ -4054,9 +4054,13 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def,
         }
     }
 
-    if (qemuCaps &&
+    /* Running domains were either started before QEMU_CAPS_CPU_MIGRATABLE was
+     * introduced and thus we can't rely on it or they already have the
+     * migratable default set. */
+    if (def->id == -1 &&
+        qemuCaps &&
         def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
-        !def->cpu->migratable) {
+        def->cpu->migratable == VIR_TRISTATE_SWITCH_ABSENT) {
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_MIGRATABLE))
             def->cpu->migratable = VIR_TRISTATE_SWITCH_ON;
         else if (ARCH_IS_X86(def->os.arch))