render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
edecca
From b1ad796106c4f1e889312c67164cce53b01cbc17 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <b1ad796106c4f1e889312c67164cce53b01cbc17@dist-git>
edecca
From: Pavel Hrdina <phrdina@redhat.com>
edecca
Date: Mon, 13 Aug 2018 19:21:50 +0200
edecca
Subject: [PATCH] tests: introduce hugepages-default-1G-nodeset-2M
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
This test case is currently working but it uncovers existing issue
edecca
in our code that the generated QEMU commandline uses the default 1G
edecca
hugepage instead of the 2M hugepage specified for exact node.
edecca
edecca
The issue in our code is that for non-numa guests we take into account
edecca
only the first hugepage.  This will be fixed as invalid configuration
edecca
since it doesn't make any sense to set default and specific hugepage
edecca
for non-numa guest.
edecca
edecca
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
edecca
(cherry picked from commit 6ff69e936e4185983fc331c45b76d3b3d8b717ae)
edecca
edecca
Conflicts:
edecca
    tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args
edecca
        - missing upstream commit <caccbba64a>
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
 .../hugepages-default-1G-nodeset-2M.args      | 26 ++++++++++++++++
edecca
 .../hugepages-default-1G-nodeset-2M.xml       | 31 +++++++++++++++++++
edecca
 tests/qemuxml2argvtest.c                      |  1 +
edecca
 .../hugepages-default-1G-nodeset-2M.xml       |  1 +
edecca
 tests/qemuxml2xmltest.c                       |  1 +
edecca
 5 files changed, 60 insertions(+)
edecca
 create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args
edecca
 create mode 100644 tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml
edecca
 create mode 120000 tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
edecca
edecca
diff --git a/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args
edecca
new file mode 100644
edecca
index 0000000000..d1f8974032
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.args
edecca
@@ -0,0 +1,26 @@
edecca
+LC_ALL=C \
edecca
+PATH=/bin \
edecca
+HOME=/home/test \
edecca
+USER=test \
edecca
+LOGNAME=test \
edecca
+QEMU_AUDIO_DRV=none \
edecca
+/usr/bin/qemu-system-i686 \
edecca
+-name SomeDummyHugepagesGuest \
edecca
+-S \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 1024 \
edecca
+-mem-prealloc \
edecca
+-mem-path /dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu \
edecca
+-smp 2,sockets=2,cores=1,threads=1 \
edecca
+-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \
edecca
+-display none \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,\
edecca
+path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \
edecca
+-mon chardev=charmonitor,id=monitor,mode=control \
edecca
+-rtc base=utc \
edecca
+-no-shutdown \
edecca
+-no-acpi \
edecca
+-boot c \
edecca
+-usb
edecca
diff --git a/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml
edecca
new file mode 100644
edecca
index 0000000000..eb0943b105
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml
edecca
@@ -0,0 +1,31 @@
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='1048576' unit='KiB'/>
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 d4251eff3e..f92c46cec5 100644
edecca
--- a/tests/qemuxml2argvtest.c
edecca
+++ b/tests/qemuxml2argvtest.c
edecca
@@ -959,6 +959,7 @@ mymain(void)
edecca
     DO_TEST("hugepages-default", NONE);
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-nonexist",
edecca
                     QEMU_CAPS_DEVICE_PC_DIMM,
edecca
                     QEMU_CAPS_OBJECT_MEMORY_FILE,
edecca
diff --git a/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
edecca
new file mode 120000
edecca
index 0000000000..3d8eb7616e
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2xmloutdata/hugepages-default-1G-nodeset-2M.xml
edecca
@@ -0,0 +1 @@
edecca
+../qemuxml2argvdata/hugepages-default-1G-nodeset-2M.xml
edecca
\ No newline at end of file
edecca
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
edecca
index 6afc48f98e..6ba8f97e20 100644
edecca
--- a/tests/qemuxml2xmltest.c
edecca
+++ b/tests/qemuxml2xmltest.c
edecca
@@ -336,6 +336,7 @@ mymain(void)
edecca
     DO_TEST("hugepages-default", NONE);
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-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