mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: save image: Split out new definition check/update
Split out the call to the update method only to places where it is actually used rather than having a mega-method that does all the stuff.
This commit is contained in:
parent
eb9595b725
commit
4e215bcb2f
@ -5503,16 +5503,6 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
if (xmlin) {
|
||||
virDomainDefPtr tmp;
|
||||
|
||||
if (!(tmp = qemuDomainSaveImageUpdateDef(driver, def, xmlin)))
|
||||
goto error;
|
||||
|
||||
virDomainDefFree(def);
|
||||
def = tmp;
|
||||
}
|
||||
|
||||
if (xmlout)
|
||||
*xmlout = xml;
|
||||
else
|
||||
@ -5655,6 +5645,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
virDomainDefPtr def = NULL;
|
||||
virDomainDefPtr newdef = NULL;
|
||||
virDomainObjPtr vm = NULL;
|
||||
int fd = -1;
|
||||
int ret = -1;
|
||||
@ -5681,6 +5672,14 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
||||
if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (dxml) {
|
||||
if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml)))
|
||||
goto cleanup;
|
||||
|
||||
virDomainDefFree(def);
|
||||
def = newdef;
|
||||
}
|
||||
|
||||
if (!(vm = virDomainObjListAdd(driver->domains, def,
|
||||
driver->xmlopt,
|
||||
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
|
||||
@ -5757,6 +5756,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
virDomainDefPtr def = NULL;
|
||||
virDomainDefPtr newdef = NULL;
|
||||
int fd = -1;
|
||||
virQEMUSaveHeader header;
|
||||
char *xml = NULL;
|
||||
@ -5784,7 +5784,10 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
||||
if (virDomainSaveImageDefineXMLEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
xml = qemuDomainDefFormatXML(driver, def,
|
||||
if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml)))
|
||||
goto cleanup;
|
||||
|
||||
xml = qemuDomainDefFormatXML(driver, newdef,
|
||||
VIR_DOMAIN_XML_INACTIVE |
|
||||
VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_MIGRATABLE);
|
||||
@ -5815,6 +5818,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
||||
|
||||
cleanup:
|
||||
virDomainDefFree(def);
|
||||
virDomainDefFree(newdef);
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
VIR_FREE(xml);
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user