mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +00:00
qemu: Introduce qemuDomainDefCheckABIStability
https://bugzilla.redhat.com/show_bug.cgi?id=994364 Whenever we check for ABI stability, we have new xml (e.g. provided by user, or obtained from snapshot, whatever) which we compare to old xml and see if ABI won't break. However, if the new xml was produced via virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some devices, e.g. 'pci-root' controller. Hence, the ABI stability check fails even though it is stable. Moreover, we can't simply fix virDomainDefCheckABIStability because removing the correct devices is task for the driver. For instance, qemu driver wants to remove the usb controller too, while LXC driver doesn't. That's why we need special qemu wrapper over virDomainDefCheckABIStability which removes the correct devices from domain XML, produces MIGRATABLE xml and calls the check ABI stability function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> (cherry picked from commit 7d704812b9c50cd3804dd1e7f9e2ea3e75fdc847)
This commit is contained in:
parent
34c592fa0d
commit
802b47a0e1
@ -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;
|
||||
}
|
||||
|
@ -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__ */
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user