These operations aren't necessarily time consuming, but need to
wait in the queue of modify jobs.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_driver.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4f333bd..caabb44 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1359,9 +1359,12 @@ libxlDomainSuspend(virDomainPtr dom)
if (virDomainSuspendEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not
running"));
- goto cleanup;
+ goto endjob;
}
priv = vm->privateData;
@@ -1371,7 +1374,7 @@ libxlDomainSuspend(virDomainPtr dom)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to suspend domain '%d' with
libxenlight"),
dom->id);
- goto cleanup;
+ goto endjob;
}
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
@@ -1381,10 +1384,13 @@ libxlDomainSuspend(virDomainPtr dom)
}
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
- goto cleanup;
+ goto endjob;
ret = 0;
+endjob:
+ libxlDomainObjEndJob(driver, vm);
+
cleanup:
if (vm)
virObjectUnlock(vm);
@@ -1411,9 +1417,12 @@ libxlDomainResume(virDomainPtr dom)
if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not
running"));
- goto cleanup;
+ goto endjob;
}
priv = vm->privateData;
@@ -1423,7 +1432,7 @@ libxlDomainResume(virDomainPtr dom)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to resume domain '%d' with
libxenlight"),
dom->id);
- goto cleanup;
+ goto endjob;
}
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
@@ -1434,10 +1443,13 @@ libxlDomainResume(virDomainPtr dom)
}
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
- goto cleanup;
+ goto endjob;
ret = 0;
+endjob:
+ libxlDomainObjEndJob(driver, vm);
+
cleanup:
if (vm)
virObjectUnlock(vm);
--
1.8.1.4