提交 b81f3056 编写于 作者: D Daniel P. Berrange

Honour error returned by virBitmapFormat

The code formatting NUMA args was ignoring the return value
of virBitmapFormat, so on OOM, it would silently drop the
NUMA cpumask arg.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 a4b0c75c
...@@ -6861,22 +6861,22 @@ qemuBuildNumaArgStr(const virDomainDefPtr def, virCommandPtr cmd) ...@@ -6861,22 +6861,22 @@ qemuBuildNumaArgStr(const virDomainDefPtr def, virCommandPtr cmd)
virCommandAddArg(cmd, "-numa"); virCommandAddArg(cmd, "-numa");
virBufferAsprintf(&buf, "node,nodeid=%d", def->cpu->cells[i].cellid); virBufferAsprintf(&buf, "node,nodeid=%d", def->cpu->cells[i].cellid);
virBufferAddLit(&buf, ",cpus="); virBufferAddLit(&buf, ",cpus=");
cpumask = virBitmapFormat(def->cpu->cells[i].cpumask); if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
if (cpumask) { goto cleanup;
/* Up through qemu 1.4, -numa does not accept a cpus
* argument any more complex than start-stop. /* Up through qemu 1.4, -numa does not accept a cpus
* * argument any more complex than start-stop.
* XXX For qemu 1.5, the syntax has not yet been decided; *
* but when it is, we need a capability bit and * XXX For qemu 1.5, the syntax has not yet been decided;
* translation of our cpumask into the qemu syntax. */ * but when it is, we need a capability bit and
if (strchr(cpumask, ',')) { * translation of our cpumask into the qemu syntax. */
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", if (strchr(cpumask, ',')) {
_("disjoint NUMA cpu ranges are not supported " virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
"with this QEMU")); _("disjoint NUMA cpu ranges are not supported "
goto cleanup; "with this QEMU"));
} goto cleanup;
virBufferAdd(&buf, cpumask, -1);
} }
virBufferAdd(&buf, cpumask, -1);
def->cpu->cells[i].mem = VIR_DIV_UP(def->cpu->cells[i].mem, def->cpu->cells[i].mem = VIR_DIV_UP(def->cpu->cells[i].mem,
1024) * 1024; 1024) * 1024;
virBufferAsprintf(&buf, ",mem=%d", def->cpu->cells[i].mem / 1024); virBufferAsprintf(&buf, ",mem=%d", def->cpu->cells[i].mem / 1024);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册