Signed-off-by: Clementine Hayat <clem(a)lse.epita.fr>
---
src/openvz/openvz_driver.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 9900e8bab..66e589313 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -575,11 +575,8 @@ static int openvzDomainSuspend(virDomainPtr dom)
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
return -1;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
@@ -605,11 +602,8 @@ static int openvzDomainResume(virDomainPtr dom)
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
return -1;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
@@ -1895,11 +1889,8 @@ openvzDomainInterfaceStats(virDomainPtr dom,
if (!(vm = openvzDomObjFromDomain(driver, dom->uuid)))
return -1;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (!(net = virDomainNetFind(vm->def, device)))
goto cleanup;
@@ -2135,11 +2126,8 @@ openvzDomainMigrateBegin3Params(virDomainPtr domain,
if (!(vm = openvzDomObjFromDomain(driver, domain->uuid)))
return NULL;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (openvzGetVEStatus(vm, &status, NULL) == -1)
goto cleanup;
--
2.17.0