]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: managedsave: Check that VM is alive after entering async job
authorPeter Krempa <pkrempa@redhat.com>
Tue, 12 Aug 2014 12:31:26 +0000 (14:31 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Aug 2014 15:31:37 +0000 (17:31 +0200)
Saving a shutoff VM doesn't make sense and libvirtd crashes while
attempting to do that. Check that the domain is alive after entering
the save async job.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1129207

src/qemu/qemu_driver.c

index 2c3f179aed0f9ed6d586181fe057f902ba15c3e2..b6219bab4dd148afaf9f3668f23088dc2547334a 100644 (file)
@@ -3096,6 +3096,12 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
     if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE) < 0)
         goto cleanup;
 
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("guest unexpectedly quit"));
+        goto endjob;
+    }
+
     memset(&priv->job.info, 0, sizeof(priv->job.info));
     priv->job.info.type = VIR_DOMAIN_JOB_UNBOUNDED;