[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 05/20] tests: extract pages-discard out of hugepages-pages



>From the args output you can see that the 'discard' feature is not
honored if you don't use hugepages, that is a bug, following patche
will fix it.

Signed-off-by: Pavel Hrdina <phrdina redhat com>
---
 tests/qemuxml2argvdata/hugepages-pages.args  | 12 +++----
 tests/qemuxml2argvdata/hugepages-pages.xml   |  3 +-
 tests/qemuxml2argvdata/pages-discard.args    | 28 +++++++++++++++
 tests/qemuxml2argvdata/pages-discard.xml     | 36 ++++++++++++++++++++
 tests/qemuxml2argvtest.c                     |  6 ++--
 tests/qemuxml2xmloutdata/hugepages-pages.xml |  3 +-
 tests/qemuxml2xmloutdata/pages-discard.xml   |  1 +
 tests/qemuxml2xmltest.c                      |  1 +
 8 files changed, 78 insertions(+), 12 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/pages-discard.args
 create mode 100644 tests/qemuxml2argvdata/pages-discard.xml
 create mode 120000 tests/qemuxml2xmloutdata/pages-discard.xml

diff --git a/tests/qemuxml2argvdata/hugepages-pages.args b/tests/qemuxml2argvdata/hugepages-pages.args
index b52cd581d5..7ece0272a0 100644
--- a/tests/qemuxml2argvdata/hugepages-pages.args
+++ b/tests/qemuxml2argvdata/hugepages-pages.args
@@ -11,20 +11,20 @@ QEMU_AUDIO_DRV=none \
 -m 4096 \
 -smp 4,sockets=4,cores=1,threads=1 \
 -object memory-backend-file,id=ram-node0,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=0-3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=0-3,policy=bind \
 -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
 -object memory-backend-file,id=ram-node1,prealloc=yes,\
 mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
 host-nodes=0-3,policy=bind \
 -numa node,nodeid=1,cpus=1,memdev=ram-node1 \
 -object memory-backend-file,id=ram-node2,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=0-3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=0-3,policy=bind \
 -numa node,nodeid=2,cpus=2,memdev=ram-node2 \
 -object memory-backend-file,id=ram-node3,prealloc=yes,\
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
-size=1073741824,host-nodes=3,policy=bind \
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
+host-nodes=3,policy=bind \
 -numa node,nodeid=3,cpus=3,memdev=ram-node3 \
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
 -display none \
diff --git a/tests/qemuxml2argvdata/hugepages-pages.xml b/tests/qemuxml2argvdata/hugepages-pages.xml
index cba83e754c..f9270782d4 100644
--- a/tests/qemuxml2argvdata/hugepages-pages.xml
+++ b/tests/qemuxml2argvdata/hugepages-pages.xml
@@ -8,7 +8,6 @@
       <page size='2048' unit='KiB' nodeset='1'/>
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
     </hugepages>
-    <discard/>
   </memoryBacking>
   <vcpu placement='static'>4</vcpu>
   <numatune>
@@ -22,7 +21,7 @@
   <cpu>
     <numa>
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/pages-discard.args b/tests/qemuxml2argvdata/pages-discard.args
new file mode 100644
index 0000000000..9db8c72a22
--- /dev/null
+++ b/tests/qemuxml2argvdata/pages-discard.args
@@ -0,0 +1,28 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 4096 \
+-smp 4,sockets=4,cores=1,threads=1 \
+-numa node,nodeid=0,cpus=0,mem=1024 \
+-numa node,nodeid=1,cpus=1,mem=1024 \
+-numa node,nodeid=2,cpus=2,mem=1024 \
+-numa node,nodeid=3,cpus=3,mem=1024 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot c \
+-usb
diff --git a/tests/qemuxml2argvdata/pages-discard.xml b/tests/qemuxml2argvdata/pages-discard.xml
new file mode 100644
index 0000000000..a8c6b74d95
--- /dev/null
+++ b/tests/qemuxml2argvdata/pages-discard.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <discard/>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-i686</emulator>
+    <controller type='usb' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f36058272f..b72d4217ea 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -960,6 +960,9 @@ mymain(void)
     DO_TEST("pmu-feature", NONE);
     DO_TEST("pmu-feature-off", NONE);
 
+    DO_TEST("pages-discard",
+            QEMU_CAPS_OBJECT_MEMORY_FILE,
+            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
     DO_TEST("hugepages-default", NONE);
     DO_TEST("hugepages-numa-default",
             QEMU_CAPS_OBJECT_MEMORY_FILE);
@@ -968,8 +971,7 @@ mymain(void)
             QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages",
             QEMU_CAPS_OBJECT_MEMORY_RAM,
-            QEMU_CAPS_OBJECT_MEMORY_FILE,
-            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
+            QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages2", QEMU_CAPS_OBJECT_MEMORY_RAM,
             QEMU_CAPS_OBJECT_MEMORY_FILE);
     DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM,
diff --git a/tests/qemuxml2xmloutdata/hugepages-pages.xml b/tests/qemuxml2xmloutdata/hugepages-pages.xml
index 292454588e..498610a217 100644
--- a/tests/qemuxml2xmloutdata/hugepages-pages.xml
+++ b/tests/qemuxml2xmloutdata/hugepages-pages.xml
@@ -8,7 +8,6 @@
       <page size='2048' unit='KiB' nodeset='1'/>
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
     </hugepages>
-    <discard/>
   </memoryBacking>
   <vcpu placement='static'>4</vcpu>
   <numatune>
@@ -22,7 +21,7 @@
   <cpu>
     <numa>
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
     </numa>
diff --git a/tests/qemuxml2xmloutdata/pages-discard.xml b/tests/qemuxml2xmloutdata/pages-discard.xml
new file mode 120000
index 0000000000..4d22fef81f
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/pages-discard.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/pages-discard.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a943975ada..2d85084d4a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -329,6 +329,7 @@ mymain(void)
     DO_TEST("pmu-feature", NONE);
     DO_TEST("pmu-feature-off", NONE);
 
+    DO_TEST("pages-discard", NONE);
     DO_TEST("hugepages-default", NONE);
     DO_TEST("hugepages-numa-default-dimm", NONE);
     DO_TEST("hugepages-pages", NONE);
-- 
2.17.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]