]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: ppc64: Support memory hotplug without NUMA enabled
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 Oct 2015 17:12:23 +0000 (19:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Nov 2015 09:32:18 +0000 (10:32 +0100)
ppc64 guests don't require adding a NUMA node for hotplug memory to
work. Lift the requirement and add test cases.

src/qemu/qemu_domain.c
tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c

index 52488ab08d6c969572f6dfef080ff8d7609980ea..1f73709d7f761d94e39791ae0330babf7a7789c2 100644 (file)
@@ -3597,11 +3597,13 @@ qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem,
             return -1;
         }
 
-        if (mem->targetNode == -1) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("target NUMA node needs to be specified for "
-                             "memory device"));
-            return -1;
+        if (virDomainNumaGetNodeCount(def->numa) != 0) {
+            if (mem->targetNode == -1) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("target NUMA node needs to be specifed for "
+                                 "memory device"));
+                return -1;
+            }
         }
 
         if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
@@ -3680,15 +3682,17 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
         return -1;
     }
 
-    /* due to guest support, qemu would silently enable NUMA with one node
-     * once the memory hotplug backend is enabled. To avoid possible
-     * confusion we will enforce user originated numa configuration along
-     * with memory hotplug. */
-    if (virDomainNumaGetNodeCount(def->numa) == 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("At least one numa node has to be configured when "
-                         "enabling memory hotplug"));
-        return -1;
+    if (!ARCH_IS_PPC64(def->os.arch)) {
+        /* due to guest support, qemu would silently enable NUMA with one node
+         * once the memory hotplug backend is enabled. To avoid possible
+         * confusion we will enforce user originated numa configuration along
+         * with memory hotplug. */
+        if (virDomainNumaGetNodeCount(def->numa) == 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("At least one numa node has to be configured when "
+                             "enabling memory hotplug"));
+            return -1;
+        }
     }
 
     if (nmems > def->mem.memory_slots) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.args b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.args
new file mode 100644 (file)
index 0000000..8b6bf3e
--- /dev/null
@@ -0,0 +1,28 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc64 \
+-name QEMUGuest1 \
+-S \
+-M pseries \
+-m size=1310720k,slots=16,maxmem=4194304k \
+-smp 1 \
+-object memory-backend-ram,id=memdimm0,size=536870912 \
+-device pc-dimm,memdev=memdimm0,id=dimm0 \
+-object memory-backend-ram,id=memdimm1,size=536870912 \
+-device pc-dimm,memdev=memdimm1,id=dimm1 \
+-uuid 49545eb3-75e1-2d0a-acdd-f0294406c99e \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-kernel /media/ram/uImage \
+-initrd /media/ram/ramdisk \
+-append 'root=/dev/ram rw console=ttyS0,115200' \
+-usb \
+-serial pty \
+-device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.xml b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-ppc64-nonuma.xml
new file mode 100644 (file)
index 0000000..b6696e2
--- /dev/null
@@ -0,0 +1,38 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>49545eb3-75e1-2d0a-acdd-f0294406c99e</uuid>
+  <maxMemory slots='16' unit='KiB'>4194304</maxMemory>
+  <memory unit='KiB'>2097152</memory>
+  <currentMemory unit='KiB'>2097152</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='ppc64' machine='pseries'>hvm</type>
+    <kernel>/media/ram/uImage</kernel>
+    <initrd>/media/ram/ramdisk</initrd>
+    <cmdline>root=/dev/ram rw console=ttyS0,115200</cmdline>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-ppc64</emulator>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <memballoon model='virtio'/>
+    <memory model='dimm'>
+      <target>
+        <size unit='KiB'>523264</size>
+      </target>
+    </memory>
+    <memory model='dimm'>
+      <target>
+        <size unit='KiB'>524287</size>
+      </target>
+    </memory>
+  </devices>
+</domain>
index 1c5282842e25526390a4ee8460c27844e1665d2a..b2454865e96cd365ec1b74d0b3a28cabf42fc4d8 100644 (file)
@@ -1651,6 +1651,8 @@ mymain(void)
             QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
             QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_FILE);
+    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
 
     DO_TEST("machine-aeskeywrap-on-caps",
             QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_AES_KEY_WRAP,