From: Clementine Hayat <clem@xxxxxxxxxxxx> Signed-off-by: Clementine Hayat <clem@xxxxxxxxxxxx> --- src/bhyve/bhyve_driver.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 24c4a9c80e..848116f14a 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -996,11 +996,8 @@ 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")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } ret = virBhyveProcessStop(privconn, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); event = virDomainEventLifecycleNewFromObj(vm, @@ -1031,11 +1028,8 @@ bhyveDomainShutdown(virDomainPtr dom) if (virDomainShutdownEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } ret = virBhyveProcessShutdown(vm); @@ -1062,11 +1056,8 @@ bhyveDomainOpenConsole(virDomainPtr dom, if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + if (virDomainObjCheckActive(vm) < 0) goto cleanup; - } if (!vm->def->nserials) { virReportError(VIR_ERR_INTERNAL_ERROR, -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list