[libvirt] [PATCH] qemu migration: assign addresses in xml passed as parameter

Usecase: 1. define domain with xml A where addresses are not set 2. migrate with '--xml A' You get ABI incompatibility because we comprare xmls with addresses set and not. This patch assign addresses in parameter xml so the comprasion is fair. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> --- src/qemu/qemu_migration.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1443d96..7cceaa1 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2992,6 +2992,7 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver, virDomainDefPtr def = NULL; qemuDomainObjPrivatePtr priv = vm->privateData; virCapsPtr caps = NULL; + virQEMUCapsPtr qemuCaps = NULL; unsigned int cookieFlags = QEMU_MIGRATION_COOKIE_LOCKSTATE; VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, dname=%s," @@ -3105,6 +3106,13 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver, VIR_DOMAIN_DEF_PARSE_INACTIVE))) goto cleanup; + if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, + def->emulator))) + goto cleanup; + + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) < 0) + goto cleanup; + if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) goto cleanup; @@ -3117,6 +3125,7 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver, qemuMigrationCookieFree(mig); virObjectUnref(caps); virDomainDefFree(def); + virObjectUnref(qemuCaps); return rv; } -- 1.8.3.1

On Tue, Feb 09, 2016 at 11:36:32 +0300, Nikolay Shirokovskiy wrote:
Usecase:
1. define domain with xml A where addresses are not set 2. migrate with '--xml A'
This use case is incorrect. To make sure the ABI compatibility checks pass, you should take the XML back from libvirt. In addition to assigning PCI addresses, libvirt may add some implicit devices (such as USB controllers, keyboards, balloon device, ...) or even reorder some elements in the XML. That said, you should follow the steps below: - define a domain using A.xml - start the domain - fetch the updated XML (virsh dumpxml --migratable >B.xml) - change whatever you need in B.xml - start migration with --xml A.xml Jirka

On 15.03.2016 21:24, Jiri Denemark wrote:
On Tue, Feb 09, 2016 at 11:36:32 +0300, Nikolay Shirokovskiy wrote:
Usecase:
1. define domain with xml A where addresses are not set 2. migrate with '--xml A'
This use case is incorrect. To make sure the ABI compatibility checks pass, you should take the XML back from libvirt. In addition to assigning PCI addresses, libvirt may add some implicit devices (such as USB controllers, keyboards, balloon device, ...) or even reorder some elements in the XML.
That said, you should follow the steps below:
- define a domain using A.xml - start the domain - fetch the updated XML (virsh dumpxml --migratable >B.xml) - change whatever you need in B.xml - start migration with --xml A.xml
Jirka
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Ok, I see. Thank you for clarification. Nikolay.
participants (2)
-
Jiri Denemark
-
Nikolay Shirokovskiy