]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: restore: Fix restoring of VM when the restore hook returns empty XML
authorPeter Krempa <pkrempa@redhat.com>
Wed, 22 Oct 2014 09:22:08 +0000 (11:22 +0200)
committerCole Robinson <crobinso@redhat.com>
Sat, 15 Nov 2014 21:02:04 +0000 (16:02 -0500)
The documentation for the restore hook states that returning an empty
XML is equivalent with copying the input. There was a bug in the code
checking the returned string by checking the string instead of the
contents. Use the new helper to check if the string is empty.

(cherry picked from commit e38677993734e9af3dbd0589e1cecd0b75f7e757)

src/qemu/qemu_driver.c

index d379c1f43174fa447dc1b493d931ebae3ac4cddc..91eba0aa99ceddb77a1d62cfc4627f4cd078366d 100644 (file)
@@ -5720,7 +5720,7 @@ qemuDomainRestoreFlags(virConnectPtr conn,
                                    &xmlout)) < 0)
             goto cleanup;
 
-        if (hookret == 0 && xmlout) {
+        if (hookret == 0 && !virStringIsEmpty(xmlout)) {
             VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
             hook_taint = true;
             newxml = xmlout;
@@ -5936,7 +5936,7 @@ qemuDomainObjRestore(virConnectPtr conn,
                                    NULL, xml, &xmlout)) < 0)
             goto cleanup;
 
-        if (hookret == 0 && xmlout) {
+        if (hookret == 0 && !virStringIsEmpty(xmlout)) {
             virDomainDefPtr tmp;
 
             VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);