mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: save image: Add possibility to return XML stored in the image
Add a new parameter that will allow to return the XML stored in the save image for further manipulation and adjust the callers. This option will be used in later patches.
This commit is contained in:
parent
92e1df2529
commit
eb9595b725
@ -5390,6 +5390,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|||||||
const char *path,
|
const char *path,
|
||||||
virDomainDefPtr *ret_def,
|
virDomainDefPtr *ret_def,
|
||||||
virQEMUSaveHeaderPtr ret_header,
|
virQEMUSaveHeaderPtr ret_header,
|
||||||
|
char **xmlout,
|
||||||
bool bypass_cache,
|
bool bypass_cache,
|
||||||
virFileWrapperFdPtr *wrapperFd,
|
virFileWrapperFdPtr *wrapperFd,
|
||||||
const char *xmlin, int state, bool edit,
|
const char *xmlin, int state, bool edit,
|
||||||
@ -5512,7 +5513,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|||||||
def = tmp;
|
def = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(xml);
|
if (xmlout)
|
||||||
|
*xmlout = xml;
|
||||||
|
else
|
||||||
|
VIR_FREE(xml);
|
||||||
|
|
||||||
*ret_def = def;
|
*ret_def = def;
|
||||||
*ret_header = header;
|
*ret_header = header;
|
||||||
@ -5668,7 +5672,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
|||||||
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
||||||
state = 0;
|
state = 0;
|
||||||
|
|
||||||
fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
|
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
||||||
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
|
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
|
||||||
&wrapperFd, dxml, state, false, false);
|
&wrapperFd, dxml, state, false, false);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -5729,8 +5733,8 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
|
|||||||
/* We only take subset of virDomainDefFormat flags. */
|
/* We only take subset of virDomainDefFormat flags. */
|
||||||
virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
|
virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
|
||||||
|
|
||||||
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, false, NULL,
|
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
||||||
NULL, -1, false, false);
|
false, NULL, NULL, -1, false, false);
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -5767,8 +5771,8 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
|||||||
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
||||||
state = 0;
|
state = 0;
|
||||||
|
|
||||||
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, false, NULL,
|
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
||||||
dxml, state, true, false);
|
false, NULL, dxml, state, true, false);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
/* Check for special case of no change needed. */
|
/* Check for special case of no change needed. */
|
||||||
@ -5832,7 +5836,7 @@ qemuDomainObjRestore(virConnectPtr conn,
|
|||||||
virQEMUSaveHeader header;
|
virQEMUSaveHeader header;
|
||||||
virFileWrapperFdPtr wrapperFd = NULL;
|
virFileWrapperFdPtr wrapperFd = NULL;
|
||||||
|
|
||||||
fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
|
fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
||||||
bypass_cache, &wrapperFd, NULL, -1, false,
|
bypass_cache, &wrapperFd, NULL, -1, false,
|
||||||
true);
|
true);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user