]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: command: Prepare memory device def formatter for missing target node
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 Oct 2015 00:02:22 +0000 (02:02 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Nov 2015 09:32:18 +0000 (10:32 +0100)
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

index e6c240c2a80f1da143fb01336625184c55eafd86..8fdf90ca284f247363e335543dd7feeca922c81e 100644 (file)
@@ -5285,8 +5285,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);