When making ABI stability checks for an active domain, we need to make sure we use the same migratable definition which virDomainGetXMLDesc with the MIGRATABLE flag provides, otherwise the ABI check will fail. This is implemented in the new qemuDomainCheckABIStability which takes a domain object and generates the right migratable definition from it. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 41 ++++++++++++++++++++++++++++++++++++----- src/qemu/qemu_domain.h | 4 ++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 01644694b..6838d2eaa 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5919,6 +5919,10 @@ qemuDomainMigratableDefCheckABIStability(virQEMUDriverPtr driver, } +#define COPY_FLAGS (VIR_DOMAIN_XML_SECURE | \ + VIR_DOMAIN_XML_UPDATE_CPU | \ + VIR_DOMAIN_XML_MIGRATABLE) + bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, virDomainDefPtr src, @@ -5926,13 +5930,10 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, { virDomainDefPtr migratableDefSrc = NULL; virDomainDefPtr migratableDefDst = NULL; - const unsigned 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))) + if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, COPY_FLAGS)) || + !(migratableDefDst = qemuDomainDefCopy(driver, dst, COPY_FLAGS))) goto cleanup; ret = qemuDomainMigratableDefCheckABIStability(driver, @@ -5945,6 +5946,36 @@ qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, return ret; } + +bool +qemuDomainCheckABIStability(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDefPtr dst) +{ + virDomainDefPtr migratableSrc = NULL; + virDomainDefPtr migratableDst = NULL; + char *xml = NULL; + bool ret = false; + + if (!(xml = qemuDomainFormatXML(driver, vm, COPY_FLAGS)) || + !(migratableSrc = qemuDomainDefFromXML(driver, xml)) || + !(migratableDst = qemuDomainDefCopy(driver, dst, COPY_FLAGS))) + goto cleanup; + + ret = qemuDomainMigratableDefCheckABIStability(driver, + vm->def, migratableSrc, + dst, migratableDst); + + cleanup: + VIR_FREE(xml); + virDomainDefFree(migratableSrc); + virDomainDefFree(migratableDst); + return ret; +} + +#undef COPY_FLAGS + + bool qemuDomainAgentAvailable(virDomainObjPtr vm, bool reportError) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ef3a33076..a2cd155c3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -666,6 +666,10 @@ bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, virDomainDefPtr src, virDomainDefPtr dst); +bool qemuDomainCheckABIStability(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainDefPtr dst); + bool qemuDomainAgentAvailable(virDomainObjPtr vm, bool reportError); -- 2.13.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list