]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Error prompt when saving a shutoff domain
authorOsier Yang <jyang@redhat.com>
Thu, 17 Feb 2011 03:18:47 +0000 (11:18 +0800)
committerOsier Yang <jyang@redhat.com>
Thu, 17 Feb 2011 03:18:47 +0000 (11:18 +0800)
"qemudDomainSaveFlag" goto wrong label "endjob", which will cause
error when security manager trying to restore label (regression).

As it's more reasonable to check if vm is shutoff immediately, and
return right away if it is, remove the checking in "qemudDomainSaveFlag",
and add checking in "qemudDomainSave".

* src/qemu/qemu_driver.c

src/qemu/qemu_driver.c

index 82a2210963761f2e0a4fbe8a80293b6e23f992a4..ab664a046c0e9fa500868e727073955e7ae0415a 100644 (file)
@@ -4303,7 +4303,9 @@ endjob:
     return ret;
 }
 
-/* this internal function expects the driver lock to already be held on entry */
+/* This internal function expects the driver lock to already be held on
+ * entry and the vm must be active.
+ */
 static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
                                virDomainObjPtr vm, const char *path,
                                int compressed)
@@ -4332,12 +4334,6 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
     if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
         goto cleanup;
 
-    if (!virDomainObjIsActive(vm)) {
-        qemuReportError(VIR_ERR_OPERATION_INVALID,
-                        "%s", _("domain is not running"));
-        goto endjob;
-    }
-
     priv->jobActive = QEMU_JOB_SAVE;
 
     memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
@@ -4656,6 +4652,12 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
         goto cleanup;
     }
 
+    if (!virDomainObjIsActive(vm)) {
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
+        goto cleanup;
+    }
+
     ret = qemudDomainSaveFlag(driver, dom, vm, path, compressed);
 
 cleanup: