diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 968e323210..f3e2ba1cf2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2342,3 +2342,25 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, priv->qemuDevices = aliases; return 0; } + +bool +qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, + virDomainDefPtr src, + virDomainDefPtr dst) +{ + virDomainDefPtr migratableDefSrc = NULL; + virDomainDefPtr migratableDefDst = NULL; + const int flags = VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_MIGRATABLE; + bool ret = false; + + if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, flags)) || + !(migratableDefDst = qemuDomainDefCopy(driver, dst, flags))) + goto cleanup; + + ret = virDomainDefCheckABIStability(migratableDefSrc, migratableDefDst); + +cleanup: + virDomainDefFree(migratableDefSrc); + virDomainDefFree(migratableDefDst); + return ret; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 04f08a3784..77e0c20171 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -369,4 +369,7 @@ extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, virDomainObjPtr vm); +bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, + virDomainDefPtr src, + virDomainDefPtr dst); #endif /* __QEMU_DOMAIN_H__ */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 58be308575..d7f92f4521 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3085,7 +3085,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, VIR_DOMAIN_XML_INACTIVE))) { goto endjob; } - if (!virDomainDefCheckABIStability(vm->def, def)) { + if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) { virDomainDefFree(def); goto endjob; } @@ -13030,7 +13030,6 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, qemuDomainObjPrivatePtr priv; int rc; virDomainDefPtr config = NULL; - virDomainDefPtr migratableDef = NULL; virQEMUDriverConfigPtr cfg = NULL; virCapsPtr caps = NULL; @@ -13147,11 +13146,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, /* Transitions 5, 6, 8, 9 */ /* Check for ABI compatibility. We need to do this check against * the migratable XML or it will always fail otherwise */ - if (!(migratableDef = qemuDomainDefCopy(driver, vm->def, - VIR_DOMAIN_XML_MIGRATABLE))) - goto cleanup; - - if (config && !virDomainDefCheckABIStability(migratableDef, config)) { + if (config && !qemuDomainDefCheckABIStability(driver, vm->def, config)) { virErrorPtr err = virGetLastError(); if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { @@ -13356,7 +13351,6 @@ cleanup: } if (vm) virObjectUnlock(vm); - virDomainDefFree(migratableDef); virObjectUnref(caps); virObjectUnref(cfg); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 58f90c2885..2db5ed083f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2043,7 +2043,7 @@ static char VIR_DOMAIN_XML_INACTIVE))) goto cleanup; - if (!virDomainDefCheckABIStability(vm->def, def)) + if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) goto cleanup; rv = qemuDomainDefFormatLive(driver, def, false, true); @@ -2250,7 +2250,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, if (!newdef) goto cleanup; - if (!virDomainDefCheckABIStability(*def, newdef)) { + if (!qemuDomainDefCheckABIStability(driver, *def, newdef)) { virDomainDefFree(newdef); goto cleanup; }