mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: allow restore with non-migratable XML input
Convert input XML to migratable before using it in qemuDomainSaveImageOpen. XML in the save image is migratable, i.e. doesn't contain implicit controllers. If these controllers were in a non-default order in the input XML, the ABI check would fail. Removing and re-adding these controllers fixes it. https://bugzilla.redhat.com/show_bug.cgi?id=834196
This commit is contained in:
parent
f2eaef3f0e
commit
07966f6a8b
@ -1275,6 +1275,35 @@ void qemuDomainObjExitRemote(virDomainObjPtr obj)
|
||||
}
|
||||
|
||||
|
||||
virDomainDefPtr
|
||||
qemuDomainDefCopy(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr src,
|
||||
unsigned int flags)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
virDomainDefPtr ret = NULL;
|
||||
virCapsPtr caps = NULL;
|
||||
const char *xml = NULL;
|
||||
|
||||
if (qemuDomainDefFormatBuf(driver, src, flags, &buf) < 0)
|
||||
goto cleanup;
|
||||
|
||||
xml = virBufferContentAndReset(&buf);
|
||||
|
||||
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(ret = virDomainDefParseString(xml, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto cleanup;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(xml);
|
||||
virObjectUnref(caps);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def,
|
||||
|
@ -241,6 +241,10 @@ void qemuDomainObjEnterRemote(virDomainObjPtr obj)
|
||||
void qemuDomainObjExitRemote(virDomainObjPtr obj)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
||||
virDomainDefPtr qemuDomainDefCopy(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr src,
|
||||
unsigned int flags);
|
||||
|
||||
int qemuDomainDefFormatBuf(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr vm,
|
||||
unsigned int flags,
|
||||
|
@ -4877,17 +4877,24 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||
goto error;
|
||||
if (xmlin) {
|
||||
virDomainDefPtr def2 = NULL;
|
||||
virDomainDefPtr newdef = NULL;
|
||||
|
||||
if (!(def2 = virDomainDefParseString(xmlin, caps, driver->xmlopt,
|
||||
QEMU_EXPECTED_VIRT_TYPES,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto error;
|
||||
if (!virDomainDefCheckABIStability(def, def2)) {
|
||||
virDomainDefFree(def2);
|
||||
|
||||
newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE);
|
||||
virDomainDefFree(def2);
|
||||
if (!newdef)
|
||||
goto error;
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, newdef)) {
|
||||
virDomainDefFree(newdef);
|
||||
goto error;
|
||||
}
|
||||
virDomainDefFree(def);
|
||||
def = def2;
|
||||
def = newdef;
|
||||
}
|
||||
|
||||
VIR_FREE(xml);
|
||||
|
Loading…
Reference in New Issue
Block a user