to ease the review of commits to follow.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e6acced..cc6023d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6541,11 +6541,22 @@ qemuBuildNumaArgStr(const virDomainDef *def, virCommandPtr cmd)
for (i = 0; i < def->cpu->ncells; i++) {
VIR_FREE(cpumask);
+ int cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024);
+ def->cpu->cells[i].mem = cellmem * 1024;
+
+ if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
+ goto cleanup;
+
+ if (strchr(cpumask, ',')) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disjoint NUMA cpu ranges are not supported "
+ "with this QEMU"));
+ goto cleanup;
+ }
+
virCommandAddArg(cmd, "-numa");
virBufferAsprintf(&buf, "node,nodeid=%d",
def->cpu->cells[i].cellid);
virBufferAddLit(&buf, ",cpus=");
- if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
- goto cleanup;
/* Up through qemu 1.4, -numa does not accept a cpus
* argument any more complex than start-stop.
@@ -6553,16 +6564,8 @@ qemuBuildNumaArgStr(const virDomainDef *def, virCommandPtr cmd)
* XXX For qemu 1.5, the syntax has not yet been decided;
* but when it is, we need a capability bit and
* translation of our cpumask into the qemu syntax. */
- if (strchr(cpumask, ',')) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disjoint NUMA cpu ranges are not supported "
- "with this QEMU"));
- goto cleanup;
- }
virBufferAdd(&buf, cpumask, -1);
- def->cpu->cells[i].mem = VIR_DIV_UP(def->cpu->cells[i].mem,
- 1024) * 1024;
- virBufferAsprintf(&buf, ",mem=%d", def->cpu->cells[i].mem /
1024);
+ virBufferAsprintf(&buf, ",mem=%d", cellmem);
if (virBufferError(&buf)) {
virReportOOMError();
--
2.0.0