[libvirt] [PATCH 2/2] qemu: don't update cpu unconditionally for migratable flag

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Sep 21 13:39:39 UTC 2017


Imagine if we use 'virsh dumpxml --migratable' for offline domain
to get config to tweak before migration. Currenly cpu section will
be expanded, host-cpu mode turns into custom and migration fails
because of ABI check.

Looks like ABI check does not make much sence for offline migration
but we don't want host-cpu mode to turn into custom in the first place.
Using --migratable is reasonable in this case because this flags
makes changes for inactive configs too like removing automatically
added parts that old versions can not handle.

I suggest not to update cpu for inactive configs. This appoach is
coherent with the way migration works for inactive configs in case
it is not specified externally to migration: function qemuMigrationCookieXMLFormat
don't expand cpu too.

Adding flag for active configs is useless because qemuDomainFormatXML
will clear it in this case. Thus we can skip adding update flag
altogether.

---

I suppose next usage of libvirt in case one need to migrate with tweaked configs:

inactive domain:

    virsh dumpxml DOM --migratable > dom.xml
    virsh migrate DOM --offline --persistent --xml dom.xml

active domain:

    virsh dumpxml DOM --migratable > active.xml
    virsh dumpxml DOM --migratable --inactive > inactive.xml
    virsh migrate DOM --persistent --xml active.xml --persistent-xml inactive.xml


 src/qemu/qemu_driver.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d9dff93..3223554 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6993,9 +6993,6 @@ static char
     if (qemuDomainUpdateCurrentMemorySize(driver, vm) < 0)
         goto cleanup;
 
-    if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
-        flags |= VIR_DOMAIN_XML_UPDATE_CPU;
-
     ret = qemuDomainFormatXML(driver, vm, flags);
 
  cleanup:
-- 
1.8.3.1




More information about the libvir-list mailing list