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 2014-03-15 19:47:15 +04:00
parent ef2c4c965b
commit 08bd268c0d

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: