mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
libxl: use job functions in libxlDomainSetSchedulerParametersFlags
Modify operation that needs to wait in the queue of modify jobs. Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
7d9ff81603
commit
e6dcb0e2a1
@ -4057,6 +4057,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
int nparams,
|
int nparams,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
libxlDriverPrivatePtr driver = dom->conn->privateData;
|
||||||
libxlDomainObjPrivatePtr priv;
|
libxlDomainObjPrivatePtr priv;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
libxl_domain_sched_params sc_info;
|
libxl_domain_sched_params sc_info;
|
||||||
@ -4079,9 +4080,12 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
|
if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def, flags) < 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;
|
||||||
@ -4091,14 +4095,14 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
if (sched_id != LIBXL_SCHEDULER_CREDIT) {
|
if (sched_id != LIBXL_SCHEDULER_CREDIT) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Only 'credit' scheduler is supported"));
|
_("Only 'credit' scheduler is supported"));
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libxl_domain_sched_params_get(priv->ctx, dom->id, &sc_info) != 0) {
|
if (libxl_domain_sched_params_get(priv->ctx, dom->id, &sc_info) != 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to get scheduler parameters for domain '%d'"
|
_("Failed to get scheduler parameters for domain '%d'"
|
||||||
" with libxenlight"), dom->id);
|
" with libxenlight"), dom->id);
|
||||||
goto cleanup;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nparams; ++i) {
|
for (i = 0; i < nparams; ++i) {
|
||||||
@ -4114,11 +4118,15 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to set scheduler parameters for domain '%d'"
|
_("Failed to set scheduler parameters for domain '%d'"
|
||||||
" with libxenlight"), dom->id);
|
" with libxenlight"), dom->id);
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user