From 08bd268c0d410615d68c0c6706183d07618cb187 Mon Sep 17 00:00:00 2001 From: Roman Bogorodskiy Date: Sat, 15 Mar 2014 19:47:15 +0400 Subject: [PATCH] bhyve: allow to destroy only active domains Add a check that domain is active before attempting to destroy it. --- src/bhyve/bhyve_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) 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: