render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
99cbc7
From 836a7bbfff3c9f8a1aafad455dade0f64b6fa57d Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <836a7bbfff3c9f8a1aafad455dade0f64b6fa57d@dist-git>
99cbc7
From: Pavel Hrdina <phrdina@redhat.com>
99cbc7
Date: Mon, 13 Aug 2018 18:16:11 +0200
99cbc7
Subject: [PATCH] tests: extract pages-discard-hugepages out of
99cbc7
 hugepages-pages3
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
Similar thing happens as for pages-discard, it is not passed to QEMU.
99cbc7
99cbc7
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
99cbc7
(cherry picked from commit 9a6674c0ff5c5857fcf9b8e5aded1f524cf75d44)
99cbc7
99cbc7
Conflicts:
99cbc7
    tests/qemuxml2argvdata/pages-discard-hugepages.args
99cbc7
        - missing upstream commit <caccbba64a>
99cbc7
99cbc7
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1591235
99cbc7
99cbc7
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 tests/qemuxml2argvdata/hugepages-pages3.args  |  3 +-
99cbc7
 tests/qemuxml2argvdata/hugepages-pages3.xml   |  4 +--
99cbc7
 .../pages-discard-hugepages.args              | 28 +++++++++++++++
99cbc7
 .../pages-discard-hugepages.xml               | 34 +++++++++++++++++++
99cbc7
 tests/qemuxml2argvtest.c                      |  7 ++--
99cbc7
 tests/qemuxml2xmloutdata/hugepages-pages3.xml |  4 +--
99cbc7
 .../pages-discard-hugepages.xml               |  1 +
99cbc7
 tests/qemuxml2xmltest.c                       |  1 +
99cbc7
 8 files changed, 74 insertions(+), 8 deletions(-)
99cbc7
 create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.args
99cbc7
 create mode 100644 tests/qemuxml2argvdata/pages-discard-hugepages.xml
99cbc7
 create mode 120000 tests/qemuxml2xmloutdata/pages-discard-hugepages.xml
99cbc7
99cbc7
diff --git a/tests/qemuxml2argvdata/hugepages-pages3.args b/tests/qemuxml2argvdata/hugepages-pages3.args
99cbc7
index d55265cdd8..2fc701ca22 100644
99cbc7
--- a/tests/qemuxml2argvdata/hugepages-pages3.args
99cbc7
+++ b/tests/qemuxml2argvdata/hugepages-pages3.args
99cbc7
@@ -13,8 +13,7 @@ QEMU_AUDIO_DRV=none \
99cbc7
 -object memory-backend-ram,id=ram-node0,size=268435456 \
99cbc7
 -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
99cbc7
 -object memory-backend-file,id=ram-node1,prealloc=yes,\
99cbc7
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu,\
99cbc7
-discard-data=yes,size=805306368 \
99cbc7
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-SomeDummyHugepagesGu,size=805306368 \
99cbc7
 -numa node,nodeid=1,cpus=1,memdev=ram-node1 \
99cbc7
 -uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \
99cbc7
 -display none \
99cbc7
diff --git a/tests/qemuxml2argvdata/hugepages-pages3.xml b/tests/qemuxml2argvdata/hugepages-pages3.xml
99cbc7
index 147acc4c95..3d3b3f3cc3 100644
99cbc7
--- a/tests/qemuxml2argvdata/hugepages-pages3.xml
99cbc7
+++ b/tests/qemuxml2argvdata/hugepages-pages3.xml
99cbc7
@@ -15,8 +15,8 @@
99cbc7
   </os>
99cbc7
   <cpu>
99cbc7
     <numa>
99cbc7
-      <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/>
99cbc7
-      <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/>
99cbc7
+      <cell id='0' cpus='0' memory='262144' unit='KiB'/>
99cbc7
+      <cell id='1' cpus='1' memory='786432' unit='KiB'/>
99cbc7
     </numa>
99cbc7
   </cpu>
99cbc7
   <clock offset='utc'/>
99cbc7
diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.args b/tests/qemuxml2argvdata/pages-discard-hugepages.args
99cbc7
new file mode 100644
99cbc7
index 0000000000..2dfacefe4a
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2argvdata/pages-discard-hugepages.args
99cbc7
@@ -0,0 +1,28 @@
99cbc7
+LC_ALL=C \
99cbc7
+PATH=/bin \
99cbc7
+HOME=/home/test \
99cbc7
+USER=test \
99cbc7
+LOGNAME=test \
99cbc7
+QEMU_AUDIO_DRV=none \
99cbc7
+/usr/bin/qemu-system-i686 \
99cbc7
+-name SomeDummyHugepagesGuest \
99cbc7
+-S \
99cbc7
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
99cbc7
+-m 1024 \
99cbc7
+-smp 2,sockets=2,cores=1,threads=1 \
99cbc7
+-mem-prealloc \
99cbc7
+-mem-path /dev/hugepages2M/libvirt/qemu/-1-SomeDummyHugepagesGu \
99cbc7
+-numa node,nodeid=0,cpus=0,mem=256 \
99cbc7
+-numa node,nodeid=1,cpus=1,mem=768 \
99cbc7
+-uuid ef1bdff4-27f3-4e85-a807-5fb4d58463cc \
99cbc7
+-display none \
99cbc7
+-no-user-config \
99cbc7
+-nodefaults \
99cbc7
+-chardev socket,id=charmonitor,\
99cbc7
+path=/tmp/lib/domain--1-SomeDummyHugepagesGu/monitor.sock,server,nowait \
99cbc7
+-mon chardev=charmonitor,id=monitor,mode=control \
99cbc7
+-rtc base=utc \
99cbc7
+-no-shutdown \
99cbc7
+-no-acpi \
99cbc7
+-boot c \
99cbc7
+-usb
99cbc7
diff --git a/tests/qemuxml2argvdata/pages-discard-hugepages.xml b/tests/qemuxml2argvdata/pages-discard-hugepages.xml
99cbc7
new file mode 100644
99cbc7
index 0000000000..d1620d1946
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2argvdata/pages-discard-hugepages.xml
99cbc7
@@ -0,0 +1,34 @@
99cbc7
+<domain type='qemu'>
99cbc7
+  <name>SomeDummyHugepagesGuest</name>
99cbc7
+  <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid>
99cbc7
+  <memory unit='KiB'>1048576</memory>
99cbc7
+  <currentMemory unit='KiB'>1048576</currentMemory>
99cbc7
+  <memoryBacking>
99cbc7
+    <hugepages/>
99cbc7
+  </memoryBacking>
99cbc7
+  <vcpu placement='static'>2</vcpu>
99cbc7
+  <os>
99cbc7
+    <type arch='i686' machine='pc'>hvm</type>
99cbc7
+    <boot dev='hd'/>
99cbc7
+  </os>
99cbc7
+  <cpu>
99cbc7
+    <numa>
99cbc7
+      <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/>
99cbc7
+      <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/>
99cbc7
+    </numa>
99cbc7
+  </cpu>
99cbc7
+  <clock offset='utc'/>
99cbc7
+  <on_poweroff>destroy</on_poweroff>
99cbc7
+  <on_reboot>restart</on_reboot>
99cbc7
+  <on_crash>destroy</on_crash>
99cbc7
+  <devices>
99cbc7
+    <emulator>/usr/bin/qemu-system-i686</emulator>
99cbc7
+    <controller type='usb' index='0'>
99cbc7
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
99cbc7
+    </controller>
99cbc7
+    <controller type='pci' index='0' model='pci-root'/>
99cbc7
+    <input type='mouse' bus='ps2'/>
99cbc7
+    <input type='keyboard' bus='ps2'/>
99cbc7
+    <memballoon model='none'/>
99cbc7
+  </devices>
99cbc7
+</domain>
99cbc7
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
99cbc7
index 6a79918f67..a95d2c1915 100644
99cbc7
--- a/tests/qemuxml2argvtest.c
99cbc7
+++ b/tests/qemuxml2argvtest.c
99cbc7
@@ -948,6 +948,10 @@ mymain(void)
99cbc7
     DO_TEST("pages-discard",
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_FILE,
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
99cbc7
+    DO_TEST("pages-discard-hugepages",
99cbc7
+            QEMU_CAPS_OBJECT_MEMORY_RAM,
99cbc7
+            QEMU_CAPS_OBJECT_MEMORY_FILE,
99cbc7
+            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
99cbc7
     DO_TEST("hugepages-default", NONE);
99cbc7
     DO_TEST("hugepages-numa-default",
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_FILE);
99cbc7
@@ -961,8 +965,7 @@ mymain(void)
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_RAM,
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_FILE);
99cbc7
     DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM,
99cbc7
-            QEMU_CAPS_OBJECT_MEMORY_FILE,
99cbc7
-            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
99cbc7
+            QEMU_CAPS_OBJECT_MEMORY_FILE);
99cbc7
     DO_TEST("hugepages-shared",
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_RAM,
99cbc7
             QEMU_CAPS_OBJECT_MEMORY_FILE);
99cbc7
diff --git a/tests/qemuxml2xmloutdata/hugepages-pages3.xml b/tests/qemuxml2xmloutdata/hugepages-pages3.xml
99cbc7
index 90e6efa5ea..be21c3eddd 100644
99cbc7
--- a/tests/qemuxml2xmloutdata/hugepages-pages3.xml
99cbc7
+++ b/tests/qemuxml2xmloutdata/hugepages-pages3.xml
99cbc7
@@ -15,8 +15,8 @@
99cbc7
   </os>
99cbc7
   <cpu>
99cbc7
     <numa>
99cbc7
-      <cell id='0' cpus='0' memory='262144' unit='KiB' discard='no'/>
99cbc7
-      <cell id='1' cpus='1' memory='786432' unit='KiB' discard='yes'/>
99cbc7
+      <cell id='0' cpus='0' memory='262144' unit='KiB'/>
99cbc7
+      <cell id='1' cpus='1' memory='786432' unit='KiB'/>
99cbc7
     </numa>
99cbc7
   </cpu>
99cbc7
   <clock offset='utc'/>
99cbc7
diff --git a/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml b/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml
99cbc7
new file mode 120000
99cbc7
index 0000000000..3d2f0682dc
99cbc7
--- /dev/null
99cbc7
+++ b/tests/qemuxml2xmloutdata/pages-discard-hugepages.xml
99cbc7
@@ -0,0 +1 @@
99cbc7
+../qemuxml2argvdata/pages-discard-hugepages.xml
99cbc7
\ No newline at end of file
99cbc7
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
99cbc7
index a4448ff168..83c0ffdfe2 100644
99cbc7
--- a/tests/qemuxml2xmltest.c
99cbc7
+++ b/tests/qemuxml2xmltest.c
99cbc7
@@ -331,6 +331,7 @@ mymain(void)
99cbc7
     DO_TEST("pmu-feature-off", NONE);
99cbc7
 
99cbc7
     DO_TEST("pages-discard", NONE);
99cbc7
+    DO_TEST("pages-discard-hugepages", NONE);
99cbc7
     DO_TEST("hugepages-default", NONE);
99cbc7
     DO_TEST("hugepages-numa-default-2M", NONE);
99cbc7
     DO_TEST("hugepages-numa-default-dimm", NONE);
99cbc7
-- 
99cbc7
2.18.0
99cbc7