]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Don't update CPU when formatting live def
authorJiri Denemark <jdenemar@redhat.com>
Fri, 30 Jun 2017 14:55:20 +0000 (16:55 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 21 Sep 2017 13:27:39 +0000 (15:27 +0200)
Since commit v2.2.0-199-g7ce711a30e libvirt stores an updated guest CPU
in domain's live definition and there's no need to update it every time
we want to format the definition. The commit itself tried to address
this in qemuDomainFormatXML, but forgot to fix qemuDomainDefFormatLive.
Not to mention that masking a previously set flag is only acceptable if
the flag was set by a public API user. Internally, libvirt should have
never set the flag in the first place.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_driver.c

index a5fe468f675a51aeb570df624586af3bff8c330d..ee664184736779a91b6687fdcfecc903af527a1b 100644 (file)
@@ -4765,8 +4765,6 @@ char *qemuDomainFormatXML(virQEMUDriverPtr driver,
     } else {
         def = vm->def;
         origCPU = priv->origCPU;
-        if (virDomainObjIsActive(vm))
-            flags &= ~VIR_DOMAIN_XML_UPDATE_CPU;
     }
 
     return qemuDomainDefFormatXMLInternal(driver, def, origCPU, flags);
index b291dc308203be371210c96677382e2e7a090347..09201b1a40fad0855eed2cfb95420d3b7c41d682 100644 (file)
@@ -40,8 +40,7 @@
 # include "logging/log_manager.h"
 
 # define QEMU_DOMAIN_FORMAT_LIVE_FLAGS      \
-    (VIR_DOMAIN_XML_SECURE |                \
-     VIR_DOMAIN_XML_UPDATE_CPU)
+    (VIR_DOMAIN_XML_SECURE)
 
 # if ULONG_MAX == 4294967295
 /* QEMU has a 64-bit limit, but we are limited by our historical choice of
index da98770dc11123bd62cd360ff348a2d02d50e056..1b271792dbd748c41deb13c45631ea97a43a774e 100644 (file)
@@ -6997,6 +6997,13 @@ static char
     if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
         flags |= QEMU_DOMAIN_FORMAT_LIVE_FLAGS;
 
+    /* The CPU is already updated in the domain's live definition, we need to
+     * ignore the VIR_DOMAIN_XML_UPDATE_CPU flag.
+     */
+    if (virDomainObjIsActive(vm) &&
+        !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE))
+        flags &= ~VIR_DOMAIN_XML_UPDATE_CPU;
+
     ret = qemuDomainFormatXML(driver, vm, flags);
 
  cleanup: