提交 f5bc5bd4 编写于 作者: J Jim Fehlig

libxl: use job functions in libxlDomain{Suspend,Resume}

These operations aren't necessarily time consuming, but need to
wait in the queue of modify jobs.
Signed-off-by: NJim Fehlig <jfehlig@suse.com>
上级 ac1444c3
...@@ -1342,9 +1342,12 @@ libxlDomainSuspend(virDomainPtr dom) ...@@ -1342,9 +1342,12 @@ libxlDomainSuspend(virDomainPtr dom)
if (virDomainSuspendEnsureACL(dom->conn, vm->def) < 0) if (virDomainSuspendEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup; goto endjob;
} }
priv = vm->privateData; priv = vm->privateData;
...@@ -1354,7 +1357,7 @@ libxlDomainSuspend(virDomainPtr dom) ...@@ -1354,7 +1357,7 @@ libxlDomainSuspend(virDomainPtr dom)
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to suspend domain '%d' with libxenlight"), _("Failed to suspend domain '%d' with libxenlight"),
dom->id); dom->id);
goto cleanup; goto endjob;
} }
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER); virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
...@@ -1364,10 +1367,14 @@ libxlDomainSuspend(virDomainPtr dom) ...@@ -1364,10 +1367,14 @@ libxlDomainSuspend(virDomainPtr dom)
} }
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
goto cleanup; goto endjob;
ret = 0; ret = 0;
endjob:
if (!libxlDomainObjEndJob(driver, vm))
vm = NULL;
cleanup: cleanup:
if (vm) if (vm)
virObjectUnlock(vm); virObjectUnlock(vm);
...@@ -1394,9 +1401,12 @@ libxlDomainResume(virDomainPtr dom) ...@@ -1394,9 +1401,12 @@ libxlDomainResume(virDomainPtr dom)
if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0) if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup; goto endjob;
} }
priv = vm->privateData; priv = vm->privateData;
...@@ -1406,7 +1416,7 @@ libxlDomainResume(virDomainPtr dom) ...@@ -1406,7 +1416,7 @@ libxlDomainResume(virDomainPtr dom)
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to resume domain '%d' with libxenlight"), _("Failed to resume domain '%d' with libxenlight"),
dom->id); dom->id);
goto cleanup; goto endjob;
} }
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
...@@ -1417,10 +1427,14 @@ libxlDomainResume(virDomainPtr dom) ...@@ -1417,10 +1427,14 @@ libxlDomainResume(virDomainPtr dom)
} }
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
goto cleanup; goto endjob;
ret = 0; ret = 0;
endjob:
if (!libxlDomainObjEndJob(driver, vm))
vm = NULL;
cleanup: cleanup:
if (vm) if (vm)
virObjectUnlock(vm); virObjectUnlock(vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册