From: Roman Bogorodskiy Date: Sat, 15 Mar 2014 15:47:15 +0000 (+0400) Subject: bhyve: allow to destroy only active domains X-Git-Tag: v1.2.3-rc1~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08bd268c0d410615d68c0c6706183d07618cb187;p=thirdparty%2Flibvirt.git bhyve: allow to destroy only active domains Add a check that domain is active before attempting to destroy it. --- diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index f50ab91119..ff9ac0d205 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -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: