bhyve: allow to destroy only active domains

Add a check that domain is active before attempting to destroy it.
This commit is contained in:
Roman Bogorodskiy committed 2014-03-17 21:28:55 +04:00
1 parent ef2c4c965b
commit 08bd268c0d
1 file changed
+6
+6
View 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: