[libvirt] [PATCH 2/3] qemu: restore: Fix restoring of VM when the restore hook returns empty XML

Peter Krempa pkrempa at redhat.com
Wed Oct 22 09:48:05 UTC 2014


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.
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 009abc6..a062c06 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5831,7 +5831,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;
-- 
2.1.0




More information about the libvir-list mailing list