[libvirt] [PATCH] qemu: Error prompt when managed save a shutoff domain

Osier Yang jyang at redhat.com
Tue Jan 25 07:49:51 UTC 2011


The problem was intrduced by commit 4303c91, which removed the checking
of domain state, this patch is to fix it.

Otherwise, improper error will be throwed, e.g.

# virsh managedsave rhel6
error: Failed to save domain rhel6 state
error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such
file or directory

---
 src/qemu/qemu_driver.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 34cc29f..575dbd3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4640,6 +4640,12 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
         goto cleanup;
     }

+    if (!virDomainObjIsActive(vm)) {
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
+        goto cleanup;
+    }
+
     name = qemuDomainManagedSavePath(driver, vm);
     if (name == NULL)
         goto cleanup;
--
1.7.3.2




More information about the libvir-list mailing list