|
|
9119d9 |
From 92e5050e1616027fe779250891e380deb0191a6d Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <92e5050e1616027fe779250891e380deb0191a6d@dist-git>
|
|
|
9119d9 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
9119d9 |
Date: Mon, 22 Sep 2014 17:52:37 +0200
|
|
|
9119d9 |
Subject: [PATCH] qemu: save image: Add possibility to return XML stored in the
|
|
|
9119d9 |
image
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1142693
|
|
|
9119d9 |
|
|
|
9119d9 |
Add a new parameter that will allow to return the XML stored in the save
|
|
|
9119d9 |
image for further manipulation and adjust the callers. This option will
|
|
|
9119d9 |
be used in later patches.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit eb9595b7250880a7a49a4944ad01a8beb7c52be3)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 18 +++++++++++-------
|
|
|
9119d9 |
1 file changed, 11 insertions(+), 7 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index 73aad99..530caef 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -5389,6 +5389,7 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|
|
9119d9 |
const char *path,
|
|
|
9119d9 |
virDomainDefPtr *ret_def,
|
|
|
9119d9 |
virQEMUSaveHeaderPtr ret_header,
|
|
|
9119d9 |
+ char **xmlout,
|
|
|
9119d9 |
bool bypass_cache,
|
|
|
9119d9 |
virFileWrapperFdPtr *wrapperFd,
|
|
|
9119d9 |
const char *xmlin, int state, bool edit,
|
|
|
9119d9 |
@@ -5511,7 +5512,10 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|
|
9119d9 |
def = tmp;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
- VIR_FREE(xml);
|
|
|
9119d9 |
+ if (xmlout)
|
|
|
9119d9 |
+ *xmlout = xml;
|
|
|
9119d9 |
+ else
|
|
|
9119d9 |
+ VIR_FREE(xml);
|
|
|
9119d9 |
|
|
|
9119d9 |
*ret_def = def;
|
|
|
9119d9 |
*ret_header = header;
|
|
|
9119d9 |
@@ -5667,7 +5671,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
|
|
9119d9 |
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
|
|
9119d9 |
state = 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
|
|
|
9119d9 |
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
|
|
9119d9 |
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
|
|
|
9119d9 |
&wrapperFd, dxml, state, false, false);
|
|
|
9119d9 |
if (fd < 0)
|
|
|
9119d9 |
@@ -5728,8 +5732,8 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
|
|
|
9119d9 |
/* We only take subset of virDomainDefFormat flags. */
|
|
|
9119d9 |
virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
|
|
|
9119d9 |
|
|
|
9119d9 |
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, false, NULL,
|
|
|
9119d9 |
- NULL, -1, false, false);
|
|
|
9119d9 |
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
|
|
9119d9 |
+ false, NULL, NULL, -1, false, false);
|
|
|
9119d9 |
|
|
|
9119d9 |
if (fd < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
@@ -5766,8 +5770,8 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
|
|
9119d9 |
else if (flags & VIR_DOMAIN_SAVE_PAUSED)
|
|
|
9119d9 |
state = 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header, false, NULL,
|
|
|
9119d9 |
- dxml, state, true, false);
|
|
|
9119d9 |
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
|
|
9119d9 |
+ false, NULL, dxml, state, true, false);
|
|
|
9119d9 |
|
|
|
9119d9 |
if (fd < 0) {
|
|
|
9119d9 |
/* Check for special case of no change needed. */
|
|
|
9119d9 |
@@ -5831,7 +5835,7 @@ qemuDomainObjRestore(virConnectPtr conn,
|
|
|
9119d9 |
virQEMUSaveHeader header;
|
|
|
9119d9 |
virFileWrapperFdPtr wrapperFd = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
- fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
|
|
|
9119d9 |
+ fd = qemuDomainSaveImageOpen(driver, path, &def, &header, NULL,
|
|
|
9119d9 |
bypass_cache, &wrapperFd, NULL, -1, false,
|
|
|
9119d9 |
true);
|
|
|
9119d9 |
if (fd < 0) {
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.1
|
|
|
9119d9 |
|