提交 4fd7a720 编写于 作者: P Peter Krempa

qemu: Fix job handling in qemuDomainSetMemoryParameters

The code modifies the domain configuration but doesn't take a MODIFY
type job to do so.
上级 e3e72743
...@@ -8996,21 +8996,24 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ...@@ -8996,21 +8996,24 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup; goto cleanup;
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags, if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
&persistentDef) < 0) &persistentDef) < 0)
goto cleanup; goto endjob;
if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) { if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cgroup memory controller is not mounted")); "%s", _("cgroup memory controller is not mounted"));
goto cleanup; goto endjob;
} }
} }
#define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \ #define VIR_GET_LIMIT_PARAMETER(PARAM, VALUE) \
if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \ if ((rc = virTypedParamsGetULLong(params, nparams, PARAM, &VALUE)) < 0) \
goto cleanup; \ goto endjob; \
\ \
if (rc == 1) \ if (rc == 1) \
set_ ## VALUE = true; set_ ## VALUE = true;
...@@ -9037,7 +9040,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ...@@ -9037,7 +9040,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("memory hard_limit tunable value must be lower " _("memory hard_limit tunable value must be lower "
"than or equal to swap_hard_limit")); "than or equal to swap_hard_limit"));
goto cleanup; goto endjob;
} }
} }
...@@ -9048,7 +9051,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ...@@ -9048,7 +9051,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
virReportSystemError(-rc, _("unable to set memory %s tunable"), \ virReportSystemError(-rc, _("unable to set memory %s tunable"), \
#VALUE); \ #VALUE); \
\ \
goto cleanup; \ goto endjob; \
} \ } \
vm->def->mem.VALUE = VALUE; \ vm->def->mem.VALUE = VALUE; \
} \ } \
...@@ -9076,10 +9079,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, ...@@ -9076,10 +9079,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG && if (flags & VIR_DOMAIN_AFFECT_CONFIG &&
virDomainSaveConfig(cfg->configDir, persistentDef) < 0) virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
goto cleanup; goto endjob;
ret = 0; ret = 0;
endjob:
qemuDomainObjEndJob(driver, vm);
cleanup: cleanup:
qemuDomObjEndAPI(&vm); qemuDomObjEndAPI(&vm);
virObjectUnref(caps); virObjectUnref(caps);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册