After set domain's numa parameters for running domain, save the change,
save the change into live xml is needed to survive restarting the libvirtd,
same story with bug 1146511; meanwihle add call
qemuDomainObjBeginJob/qemuDomainObjEndJob in qemuDomainSetNumaParameters
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
src/qemu/qemu_driver.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 188b4f5..ead53ad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8986,15 +8986,18 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, vm, &flags,
&persistentDef) < 0)
- goto cleanup;
+ goto endjob;
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cgroup cpuset controller is not mounted"));
- goto cleanup;
+ goto endjob;
}
}
@@ -9007,18 +9010,18 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
if (mode < 0 || mode >= VIR_DOMAIN_NUMATUNE_MEM_LAST) {
virReportError(VIR_ERR_INVALID_ARG,
_("unsupported numatune mode: '%d'"),
mode);
- goto cleanup;
+ goto endjob;
}
} else if (STREQ(param->field, VIR_DOMAIN_NUMA_NODESET)) {
if (virBitmapParse(param->value.s, 0, &nodeset,
VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
+ goto endjob;
if (virBitmapIsAllClear(nodeset)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Invalid nodeset for numatune"));
- goto cleanup;
+ goto endjob;
}
}
}
@@ -9028,18 +9031,21 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
virDomainNumatuneGetMode(vm->def->numatune, -1) != mode) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("can't change numatune mode for running
domain"));
- goto cleanup;
+ goto endjob;
}
if (nodeset &&
qemuDomainSetNumaParamsLive(vm, caps, nodeset) < 0)
- goto cleanup;
+ goto endjob;
if (virDomainNumatuneSet(&vm->def->numatune,
vm->def->placement_mode ==
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
-1, mode, nodeset) < 0)
- goto cleanup;
+ goto endjob;
+
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
+ goto endjob;
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -9047,14 +9053,18 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
persistentDef->placement_mode ==
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
-1, mode, nodeset) < 0)
- goto cleanup;
+ goto endjob;
if (virDomainSaveConfig(cfg->configDir, persistentDef) < 0)
- goto cleanup;
+ goto endjob;
}
ret = 0;
+ endjob:
+ if (!qemuDomainObjEndJob(driver, vm))
+ vm = NULL;
+
cleanup:
virBitmapFree(nodeset);
if (vm)
--
1.9.3