Blame SOURCES/libvirt-qemu-restore-Fix-restoring-of-VM-when-the-restore-hook-returns-empty-XML.patch

9119d9
From 12f71d1ec11e0acaf369b16a9bd6965f69f94e74 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <12f71d1ec11e0acaf369b16a9bd6965f69f94e74@dist-git>
9119d9
From: Peter Krempa <pkrempa@redhat.com>
9119d9
Date: Wed, 22 Oct 2014 18:29:46 +0200
9119d9
Subject: [PATCH] qemu: restore: Fix restoring of VM when the restore hook
9119d9
 returns empty XML
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1142693
9119d9
9119d9
The documentation for the restore hook states that returning an empty
9119d9
XML is equivalent with copying the input. There was a bug in the code
9119d9
checking the returned string by checking the string instead of the
9119d9
contents. Use the new helper to check if the string is empty.
9119d9
9119d9
(cherry picked from commit e38677993734e9af3dbd0589e1cecd0b75f7e757)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c | 4 ++--
9119d9
 1 file changed, 2 insertions(+), 2 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index 4c57fcd..039b987 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -5727,7 +5727,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
9119d9
                                    &xmlout)) < 0)
9119d9
             goto cleanup;
9119d9
 
9119d9
-        if (hookret == 0 && xmlout) {
9119d9
+        if (hookret == 0 && !virStringIsEmpty(xmlout)) {
9119d9
             VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
9119d9
             hook_taint = true;
9119d9
             newxml = xmlout;
9119d9
@@ -5943,7 +5943,7 @@ qemuDomainObjRestore(virConnectPtr conn,
9119d9
                                    NULL, xml, &xmlout)) < 0)
9119d9
             goto cleanup;
9119d9
 
9119d9
-        if (hookret == 0 && xmlout) {
9119d9
+        if (hookret == 0 && !virStringIsEmpty(xmlout)) {
9119d9
             virDomainDefPtr tmp;
9119d9
 
9119d9
             VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
9119d9
-- 
9119d9
2.1.3
9119d9