bhyve: start using virDomainObjCheckActive

Signed-off-by: Clementine Hayat <clem@lse.epita.fr>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Clementine Hayat 2018-05-14 00:32:15 +02:00 committed by Ján Tomko
parent 3c311d7e9b
commit 920a7d3336

View File

@ -989,11 +989,8 @@ bhyveDomainDestroy(virDomainPtr dom)
if (virDomainDestroyEnsureACL(dom->conn, vm->def) < 0) if (virDomainDestroyEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (!virDomainObjIsActive(vm)) { if (virDomainObjCheckActive(vm) < 0)
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup; goto cleanup;
}
ret = virBhyveProcessStop(privconn, vm, VIR_DOMAIN_SHUTOFF_DESTROYED); ret = virBhyveProcessStop(privconn, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
@ -1022,11 +1019,8 @@ bhyveDomainShutdown(virDomainPtr dom)
if (virDomainShutdownEnsureACL(dom->conn, vm->def) < 0) if (virDomainShutdownEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (!virDomainObjIsActive(vm)) { if (virDomainObjCheckActive(vm) < 0)
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("Domain is not running"));
goto cleanup; goto cleanup;
}
ret = virBhyveProcessShutdown(vm); ret = virBhyveProcessShutdown(vm);
@ -1053,11 +1047,8 @@ bhyveDomainOpenConsole(virDomainPtr dom,
if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0) if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (!virDomainObjIsActive(vm)) { if (virDomainObjCheckActive(vm) < 0)
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto cleanup; goto cleanup;
}
if (!vm->def->nserials) { if (!vm->def->nserials) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,