render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
edecca
From d4bb90f58723489d9e25c09f4b709130d59d0274 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <d4bb90f58723489d9e25c09f4b709130d59d0274@dist-git>
edecca
From: Pavel Hrdina <phrdina@redhat.com>
edecca
Date: Mon, 13 Aug 2018 19:21:40 +0200
edecca
Subject: [PATCH] tests: extract pages-discard out of hugepages-pages
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
>From the args output you can see that the 'discard' feature is not
edecca
honored if you don't use hugepages, that is a bug, following patche
edecca
will fix it.
edecca
edecca
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
edecca
(cherry picked from commit aa6a5e09953fea6d379dcb3a330a3fb6d0cf0a0b)
edecca
edecca
Conflicts:
edecca
    tests/qemuxml2argvdata/pages-discard.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
 tests/qemuxml2argvdata/hugepages-pages.args  | 12 +++----
edecca
 tests/qemuxml2argvdata/hugepages-pages.xml   |  3 +-
edecca
 tests/qemuxml2argvdata/pages-discard.args    | 28 +++++++++++++++
edecca
 tests/qemuxml2argvdata/pages-discard.xml     | 36 ++++++++++++++++++++
edecca
 tests/qemuxml2argvtest.c                     |  6 ++--
edecca
 tests/qemuxml2xmloutdata/hugepages-pages.xml |  3 +-
edecca
 tests/qemuxml2xmloutdata/pages-discard.xml   |  1 +
edecca
 tests/qemuxml2xmltest.c                      |  1 +
edecca
 8 files changed, 78 insertions(+), 12 deletions(-)
edecca
 create mode 100644 tests/qemuxml2argvdata/pages-discard.args
edecca
 create mode 100644 tests/qemuxml2argvdata/pages-discard.xml
edecca
 create mode 120000 tests/qemuxml2xmloutdata/pages-discard.xml
edecca
edecca
diff --git a/tests/qemuxml2argvdata/hugepages-pages.args b/tests/qemuxml2argvdata/hugepages-pages.args
edecca
index b52cd581d5..7ece0272a0 100644
edecca
--- a/tests/qemuxml2argvdata/hugepages-pages.args
edecca
+++ b/tests/qemuxml2argvdata/hugepages-pages.args
edecca
@@ -11,20 +11,20 @@ QEMU_AUDIO_DRV=none \
edecca
 -m 4096 \
edecca
 -smp 4,sockets=4,cores=1,threads=1 \
edecca
 -object memory-backend-file,id=ram-node0,prealloc=yes,\
edecca
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
edecca
-size=1073741824,host-nodes=0-3,policy=bind \
edecca
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
edecca
+host-nodes=0-3,policy=bind \
edecca
 -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
edecca
 -object memory-backend-file,id=ram-node1,prealloc=yes,\
edecca
 mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
edecca
 host-nodes=0-3,policy=bind \
edecca
 -numa node,nodeid=1,cpus=1,memdev=ram-node1 \
edecca
 -object memory-backend-file,id=ram-node2,prealloc=yes,\
edecca
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
edecca
-size=1073741824,host-nodes=0-3,policy=bind \
edecca
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
edecca
+host-nodes=0-3,policy=bind \
edecca
 -numa node,nodeid=2,cpus=2,memdev=ram-node2 \
edecca
 -object memory-backend-file,id=ram-node3,prealloc=yes,\
edecca
-mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,discard-data=yes,\
edecca
-size=1073741824,host-nodes=3,policy=bind \
edecca
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,size=1073741824,\
edecca
+host-nodes=3,policy=bind \
edecca
 -numa node,nodeid=3,cpus=3,memdev=ram-node3 \
edecca
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
 -display none \
edecca
diff --git a/tests/qemuxml2argvdata/hugepages-pages.xml b/tests/qemuxml2argvdata/hugepages-pages.xml
edecca
index cba83e754c..f9270782d4 100644
edecca
--- a/tests/qemuxml2argvdata/hugepages-pages.xml
edecca
+++ b/tests/qemuxml2argvdata/hugepages-pages.xml
edecca
@@ -8,7 +8,6 @@
edecca
       <page size='2048' unit='KiB' nodeset='1'/>
edecca
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
edecca
     </hugepages>
edecca
-    <discard/>
edecca
   </memoryBacking>
edecca
   <vcpu placement='static'>4</vcpu>
edecca
   <numatune>
edecca
@@ -22,7 +21,7 @@
edecca
   <cpu>
edecca
     <numa>
edecca
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
edecca
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
edecca
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
edecca
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
edecca
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
edecca
     </numa>
edecca
diff --git a/tests/qemuxml2argvdata/pages-discard.args b/tests/qemuxml2argvdata/pages-discard.args
edecca
new file mode 100644
edecca
index 0000000000..9db8c72a22
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/pages-discard.args
edecca
@@ -0,0 +1,28 @@
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 QEMUGuest1 \
edecca
+-S \
edecca
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
edecca
+-m 4096 \
edecca
+-smp 4,sockets=4,cores=1,threads=1 \
edecca
+-numa node,nodeid=0,cpus=0,mem=1024 \
edecca
+-numa node,nodeid=1,cpus=1,mem=1024 \
edecca
+-numa node,nodeid=2,cpus=2,mem=1024 \
edecca
+-numa node,nodeid=3,cpus=3,mem=1024 \
edecca
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
edecca
+-display none \
edecca
+-no-user-config \
edecca
+-nodefaults \
edecca
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
edecca
+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/pages-discard.xml b/tests/qemuxml2argvdata/pages-discard.xml
edecca
new file mode 100644
edecca
index 0000000000..a8c6b74d95
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2argvdata/pages-discard.xml
edecca
@@ -0,0 +1,36 @@
edecca
+<domain type='qemu'>
edecca
+  <name>QEMUGuest1</name>
edecca
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
edecca
+  <memory unit='KiB'>4194304</memory>
edecca
+  <currentMemory unit='KiB'>4194304</currentMemory>
edecca
+  <memoryBacking>
edecca
+    <discard/>
edecca
+  </memoryBacking>
edecca
+  <vcpu placement='static'>4</vcpu>
edecca
+  <os>
edecca
+    <type arch='i686' machine='pc'>hvm</type>
edecca
+    <boot dev='hd'/>
edecca
+  </os>
edecca
+  <cpu>
edecca
+    <numa>
edecca
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
edecca
+      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
edecca
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
edecca
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
edecca
+    </numa>
edecca
+  </cpu>
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 19fb7a0931..ea26d17a63 100644
edecca
--- a/tests/qemuxml2argvtest.c
edecca
+++ b/tests/qemuxml2argvtest.c
edecca
@@ -945,6 +945,9 @@ mymain(void)
edecca
     DO_TEST("pmu-feature", NONE);
edecca
     DO_TEST("pmu-feature-off", NONE);
edecca
 
edecca
+    DO_TEST("pages-discard",
edecca
+            QEMU_CAPS_OBJECT_MEMORY_FILE,
edecca
+            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
edecca
     DO_TEST("hugepages-default", NONE);
edecca
     DO_TEST("hugepages-numa-default",
edecca
             QEMU_CAPS_OBJECT_MEMORY_FILE);
edecca
@@ -953,8 +956,7 @@ mymain(void)
edecca
             QEMU_CAPS_OBJECT_MEMORY_FILE);
edecca
     DO_TEST("hugepages-pages",
edecca
             QEMU_CAPS_OBJECT_MEMORY_RAM,
edecca
-            QEMU_CAPS_OBJECT_MEMORY_FILE,
edecca
-            QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD);
edecca
+            QEMU_CAPS_OBJECT_MEMORY_FILE);
edecca
     DO_TEST("hugepages-pages2", QEMU_CAPS_OBJECT_MEMORY_RAM,
edecca
             QEMU_CAPS_OBJECT_MEMORY_FILE);
edecca
     DO_TEST("hugepages-pages3", QEMU_CAPS_OBJECT_MEMORY_RAM,
edecca
diff --git a/tests/qemuxml2xmloutdata/hugepages-pages.xml b/tests/qemuxml2xmloutdata/hugepages-pages.xml
edecca
index 292454588e..498610a217 100644
edecca
--- a/tests/qemuxml2xmloutdata/hugepages-pages.xml
edecca
+++ b/tests/qemuxml2xmloutdata/hugepages-pages.xml
edecca
@@ -8,7 +8,6 @@
edecca
       <page size='2048' unit='KiB' nodeset='1'/>
edecca
       <page size='1048576' unit='KiB' nodeset='0,2-3'/>
edecca
     </hugepages>
edecca
-    <discard/>
edecca
   </memoryBacking>
edecca
   <vcpu placement='static'>4</vcpu>
edecca
   <numatune>
edecca
@@ -22,7 +21,7 @@
edecca
   <cpu>
edecca
     <numa>
edecca
       <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
edecca
-      <cell id='1' cpus='1' memory='1048576' unit='KiB' discard='no'/>
edecca
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
edecca
       <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
edecca
       <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
edecca
     </numa>
edecca
diff --git a/tests/qemuxml2xmloutdata/pages-discard.xml b/tests/qemuxml2xmloutdata/pages-discard.xml
edecca
new file mode 120000
edecca
index 0000000000..4d22fef81f
edecca
--- /dev/null
edecca
+++ b/tests/qemuxml2xmloutdata/pages-discard.xml
edecca
@@ -0,0 +1 @@
edecca
+../qemuxml2argvdata/pages-discard.xml
edecca
\ No newline at end of file
edecca
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
edecca
index 5900f4de61..b4bd9ebc4c 100644
edecca
--- a/tests/qemuxml2xmltest.c
edecca
+++ b/tests/qemuxml2xmltest.c
edecca
@@ -330,6 +330,7 @@ mymain(void)
edecca
     DO_TEST("pmu-feature", NONE);
edecca
     DO_TEST("pmu-feature-off", NONE);
edecca
 
edecca
+    DO_TEST("pages-discard", NONE);
edecca
     DO_TEST("hugepages-default", NONE);
edecca
     DO_TEST("hugepages-numa-default-dimm", NONE);
edecca
     DO_TEST("hugepages-pages", NONE);
edecca
-- 
edecca
2.18.0
edecca