edecca
From becdbd9b2155dccde29cfa859c4948cf9f8cab8a Mon Sep 17 00:00:00 2001
edecca
Message-Id: <becdbd9b2155dccde29cfa859c4948cf9f8cab8a@dist-git>
edecca
From: Pavel Hrdina <phrdina@redhat.com>
edecca
Date: Mon, 13 Aug 2018 19:21:51 +0200
edecca
Subject: [PATCH] tests: introduce hugepages-nodeset
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
This use-case was broken by commit
edecca
<fa6bdf6afa878b8d7c5ed71664ee72be8967cdc5>.
edecca
edecca
We allowed this configuration and it was working as expected therefore
edecca
we can consider it as regression.  We should have never allowed such
edecca
configuration so now the best solution is in case of non-numa guest
edecca
silently ignore the 'nodeset' attribute if it's set to '0'.
edecca
edecca
That will be fixed by following patches.
edecca
edecca
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
edecca
(cherry picked from commit 154b08a3a7b1f16fefefcc106982a062c065eacd)
edecca
edecca
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1615461
edecca
edecca
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 tests/qemuxml2argvdata/hugepages-nodeset.xml  | 30 +++++++++++++++++++
edecca
 tests/qemuxml2argvtest.c                      |  1 +
edecca
 .../qemuxml2xmloutdata/hugepages-nodeset.xml  |  1 +
edecca
 tests/qemuxml2xmltest.c                       |  1 +
edecca
 4 files changed, 33 insertions(+)
edecca
 create mode 100644 tests/qemuxml2argvdata/hugepages-nodeset.xml
edecca
 create mode 120000 tests/qemuxml2xmloutdata/hugepages-nodeset.xml
edecca
edecca
diff --git a/tests/qemuxml2argvdata/hugepages-nodeset.xml b/tests/qemuxml2argvdata/hugepages-nodeset.xml
edecca
new file mode 100644
edecca
index 0000000000..4a85ddffad
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hugepages-nodeset.xml
edecca
@@ -0,0 +1,30 @@
edecca
+<domain type='qemu'>
edecca
+  <name>SomeDummyHugepagesGuest</name>
edecca
+  <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
edecca
+  <memory unit='KiB'>1048576</memory>
edecca
+  <currentMemory unit='KiB'>1048576</currentMemory>
edecca
+  <memoryBacking>
edecca
+    <hugepages>
edecca
+      <page size='2048' unit='KiB' nodeset='0'/>
edecca
+    </hugepages>
edecca
+  </memoryBacking>
edecca
+  <vcpu placement='static'>2</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <clock offset='utc'/>
edecca
+  <on_poweroff>destroy</on_poweroff>
edecca
+  <on_reboot>restart</on_reboot>
edecca
+  <on_crash>destroy</on_crash>
edecca
+  <devices>
edecca
+    <emulator>/usr/bin/qemu-system-i686</emulator>
edecca
+    <controller type='usb' index='0'>
edecca
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
edecca
+    </controller>
edecca
+    <controller type='pci' index='0' model='pci-root'/>
edecca
+    <input type='mouse' bus='ps2'/>
edecca
+    <input type='keyboard' bus='ps2'/>
edecca
+    <memballoon model='none'/>
edecca
+  </devices>
edecca
+</domain>
edecca
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
edecca
index f92c46cec5..bd5fdf9412 100644
edecca
--- a/tests/qemuxml2argvtest.c
edecca
+++ b/tests/qemuxml2argvtest.c
edecca
@@ -960,6 +960,7 @@ mymain(void)
edecca
     DO_TEST("hugepages-default-2M", NONE);
edecca
     DO_TEST("hugepages-default-system-size", NONE);
edecca
     DO_TEST("hugepages-default-1G-nodeset-2M", NONE);
edecca
+    DO_TEST_FAILURE("hugepages-nodeset", NONE);
edecca
     DO_TEST_FAILURE("hugepages-nodeset-nonexist",
edecca
                     QEMU_CAPS_DEVICE_PC_DIMM,
edecca
                     QEMU_CAPS_OBJECT_MEMORY_FILE,
edecca
diff --git a/tests/qemuxml2xmloutdata/hugepages-nodeset.xml b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
edecca
new file mode 120000
edecca
index 0000000000..b55838b780
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2xmloutdata/hugepages-nodeset.xml
edecca
@@ -0,0 +1 @@
edecca
+../qemuxml2argvdata/hugepages-nodeset.xml
edecca
\ No newline at end of file
edecca
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
edecca
index 6ba8f97e20..acbe2f7133 100644
edecca
--- a/tests/qemuxml2xmltest.c
edecca
+++ b/tests/qemuxml2xmltest.c
edecca
@@ -337,6 +337,7 @@ mymain(void)
edecca
     DO_TEST("hugepages-default-2M", NONE);
edecca
     DO_TEST("hugepages-default-system-size", NONE);
edecca
     DO_TEST("hugepages-default-1G-nodeset-2M", NONE);
edecca
+    DO_TEST("hugepages-nodeset", NONE);
edecca
     DO_TEST("hugepages-numa-default-2M", NONE);
edecca
     DO_TEST("hugepages-numa-default-dimm", NONE);
edecca
     DO_TEST("hugepages-numa-nodeset", NONE);
edecca
-- 
edecca
2.18.0
edecca