mirror of https://gitee.com/openkylin/libvirt.git
qemu: Fix checking of ABI stability when restoring external checkpoints
External checkpoints have a bug in the implementation where they use the
normal definition instead of the "migratable" one. This causes errors
when the snapshot is being reverted using the workaround method via
qemuDomainRestoreFlags() with a custom XML. This issue was introduced
when commit 07966f6a8b
changed the code to
compare "migratable" XMLs from the user as we should have used
migratable in the image too.
This patch adds a compatibility layer, so that fixing the snapshot code
won't make existing snapshots fail to load.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
This commit is contained in:
parent
0925ad4e28
commit
59898a88ce
|
@ -5251,14 +5251,31 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE);
|
newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE);
|
||||||
virDomainDefFree(def2);
|
if (!newdef) {
|
||||||
if (!newdef)
|
virDomainDefFree(def2);
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (!virDomainDefCheckABIStability(def, newdef)) {
|
if (!virDomainDefCheckABIStability(def, newdef)) {
|
||||||
virDomainDefFree(newdef);
|
virDomainDefFree(newdef);
|
||||||
goto error;
|
virResetLastError();
|
||||||
|
|
||||||
|
/* Due to a bug in older version of external snapshot creation
|
||||||
|
* code, the XML saved in the save image was not a migratable
|
||||||
|
* XML. To ensure backwards compatibility with the change of the
|
||||||
|
* saved XML type, we need to check the ABI compatibility against
|
||||||
|
* the user provided XML if the check against the migratable XML
|
||||||
|
* fails. Snapshots created prior to v1.1.3 have this issue. */
|
||||||
|
if (!virDomainDefCheckABIStability(def, def2)) {
|
||||||
|
virDomainDefFree(def2);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* use the user provided XML */
|
||||||
|
newdef = def2;
|
||||||
|
def2 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virDomainDefFree(def);
|
virDomainDefFree(def);
|
||||||
def = newdef;
|
def = newdef;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue