]> xenbits.xensource.com Git - libvirt.git/commitdiff
bhyve: allow to destroy only active domains
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sat, 15 Mar 2014 15:47:15 +0000 (19:47 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 17 Mar 2014 17:28:55 +0000 (21:28 +0400)
Add a check that domain is active before attempting to destroy it.

src/bhyve/bhyve_driver.c

index f50ab91119dfb4c04b89d0b600b579ab7b236d01..ff9ac0d205438f56d0eb8d2c41e032fff78289d8 100644 (file)
@@ -567,6 +567,12 @@ bhyveDomainDestroy(virDomainPtr dom)
     if (virDomainDestroyEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is not running"));
+        goto cleanup;
+    }
+
     ret = virBhyveProcessStop(privconn, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
 
 cleanup: