Prepare the command line generator for the possibility that in some
configurations the target NUMA node info will be missing.
---
src/qemu/qemu_command.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5e7b052..9815732 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5331,8 +5331,13 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
switch ((virDomainMemoryModel) mem->model) {
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
- virBufferAsprintf(&buf, "pc-dimm,node=%d,memdev=mem%s,id=%s",
- mem->targetNode, mem->info.alias, mem->info.alias);
+ virBufferAddLit(&buf, "pc-dimm,");
+
+ if (mem->targetNode >= 0)
+ virBufferAsprintf(&buf, "node=%d,", mem->targetNode);
+
+ virBufferAsprintf(&buf, "memdev=mem%s,id=%s",
+ mem->info.alias, mem->info.alias);
if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
virBufferAsprintf(&buf, ",slot=%d",
mem->info.addr.dimm.slot);
--
2.4.5