|
|
9119d9 |
From 1b1bbd468451d73c72aaf27d4ab8f85866b78299 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <1b1bbd468451d73c72aaf27d4ab8f85866b78299@dist-git>
|
|
|
9119d9 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
9119d9 |
Date: Mon, 22 Sep 2014 17:52:38 +0200
|
|
|
9119d9 |
Subject: [PATCH] qemu: save image: Split out new definition check/update
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1142693
|
|
|
9119d9 |
|
|
|
9119d9 |
Split out the call to the update method only to places where it is
|
|
|
9119d9 |
actually used rather than having a mega-method that does all the stuff.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit 4e215bcb2f522f898872dc551d3df3cd68c653ba)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 26 +++++++++++++++-----------
|
|
|
9119d9 |
1 file changed, 15 insertions(+), 11 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index 530caef..96c7dd2 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -5502,16 +5502,6 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
|
|
9119d9 |
VIR_DOMAIN_XML_INACTIVE)))
|
|
|
9119d9 |
goto error;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (xmlin) {
|
|
|
9119d9 |
- virDomainDefPtr tmp;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- if (!(tmp = qemuDomainSaveImageUpdateDef(driver, def, xmlin)))
|
|
|
9119d9 |
- goto error;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- virDomainDefFree(def);
|
|
|
9119d9 |
- def = tmp;
|
|
|
9119d9 |
- }
|
|
|
9119d9 |
-
|
|
|
9119d9 |
if (xmlout)
|
|
|
9119d9 |
*xmlout = xml;
|
|
|
9119d9 |
else
|
|
|
9119d9 |
@@ -5654,6 +5644,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
|
|
9119d9 |
{
|
|
|
9119d9 |
virQEMUDriverPtr driver = conn->privateData;
|
|
|
9119d9 |
virDomainDefPtr def = NULL;
|
|
|
9119d9 |
+ virDomainDefPtr newdef = NULL;
|
|
|
9119d9 |
virDomainObjPtr vm = NULL;
|
|
|
9119d9 |
int fd = -1;
|
|
|
9119d9 |
int ret = -1;
|
|
|
9119d9 |
@@ -5680,6 +5671,14 @@ qemuDomainRestoreFlags(virConnectPtr conn,
|
|
|
9119d9 |
if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (dxml) {
|
|
|
9119d9 |
+ if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml)))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ virDomainDefFree(def);
|
|
|
9119d9 |
+ def = newdef;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (!(vm = virDomainObjListAdd(driver->domains, def,
|
|
|
9119d9 |
driver->xmlopt,
|
|
|
9119d9 |
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
|
|
|
9119d9 |
@@ -5756,6 +5755,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
|
|
9119d9 |
virQEMUDriverPtr driver = conn->privateData;
|
|
|
9119d9 |
int ret = -1;
|
|
|
9119d9 |
virDomainDefPtr def = NULL;
|
|
|
9119d9 |
+ virDomainDefPtr newdef = NULL;
|
|
|
9119d9 |
int fd = -1;
|
|
|
9119d9 |
virQEMUSaveHeader header;
|
|
|
9119d9 |
char *xml = NULL;
|
|
|
9119d9 |
@@ -5783,7 +5783,10 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
|
|
9119d9 |
if (virDomainSaveImageDefineXMLEnsureACL(conn, def) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
- xml = qemuDomainDefFormatXML(driver, def,
|
|
|
9119d9 |
+ if (!(newdef = qemuDomainSaveImageUpdateDef(driver, def, dxml)))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ xml = qemuDomainDefFormatXML(driver, newdef,
|
|
|
9119d9 |
VIR_DOMAIN_XML_INACTIVE |
|
|
|
9119d9 |
VIR_DOMAIN_XML_SECURE |
|
|
|
9119d9 |
VIR_DOMAIN_XML_MIGRATABLE);
|
|
|
9119d9 |
@@ -5814,6 +5817,7 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path,
|
|
|
9119d9 |
|
|
|
9119d9 |
cleanup:
|
|
|
9119d9 |
virDomainDefFree(def);
|
|
|
9119d9 |
+ virDomainDefFree(newdef);
|
|
|
9119d9 |
VIR_FORCE_CLOSE(fd);
|
|
|
9119d9 |
VIR_FREE(xml);
|
|
|
9119d9 |
return ret;
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.1
|
|
|
9119d9 |
|