[PATCH 02/20] qemuxml2(argv|xml): Modernize 'discard'/'detect-zero' tests

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

 



Switch to DO_TEST_CAPS_LATEST for all of them and also add pre-blockdev
case for 'disk-discard' as we had it before.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 .../disk-detect-zeroes.x86_64-2.12.0.args     |  1 +
 tests/qemuxml2argvdata/disk-detect-zeroes.xml |  5 +-
 ...rd.args => disk-discard.x86_64-4.1.0.args} | 22 +++++----
 .../disk-discard.x86_64-latest.args           | 46 +++++++++++++++++++
 tests/qemuxml2argvtest.c                      |  7 +--
 ...l => disk-detect-zeroes.x86_64-latest.xml} |  0
 ...ard.xml => disk-discard.x86_64-latest.xml} |  7 ++-
 tests/qemuxml2xmltest.c                       |  4 +-
 8 files changed, 73 insertions(+), 19 deletions(-)
 rename tests/qemuxml2argvdata/{disk-discard.args => disk-discard.x86_64-4.1.0.args} (59%)
 create mode 100644 tests/qemuxml2argvdata/disk-discard.x86_64-latest.args
 rename tests/qemuxml2xmloutdata/{disk-detect-zeroes.xml => disk-detect-zeroes.x86_64-latest.xml} (100%)
 rename tests/qemuxml2xmloutdata/{disk-discard.xml => disk-discard.x86_64-latest.xml} (87%)

diff --git a/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args
index 1da46d8987..090cccdb5c 100644
--- a/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-detect-zeroes.x86_64-2.12.0.args
@@ -13,6 +13,7 @@ QEMU_AUDIO_DRV=none \
 -object secret,id=masterKey0,format=raw,\
 file=/tmp/lib/domain--1-test/master-key.aes \
 -machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
+-cpu qemu64 \
 -m 1024 \
 -realtime mlock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
diff --git a/tests/qemuxml2argvdata/disk-detect-zeroes.xml b/tests/qemuxml2argvdata/disk-detect-zeroes.xml
index d1ae37b81b..851077545e 100644
--- a/tests/qemuxml2argvdata/disk-detect-zeroes.xml
+++ b/tests/qemuxml2argvdata/disk-detect-zeroes.xml
@@ -10,6 +10,9 @@
     <boot dev='hd'/>
     <bootmenu enable='yes'/>
   </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
@@ -29,7 +32,7 @@
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'>
+    <controller type='usb' index='0' model='piix3-uhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='ide' index='0'>
diff --git a/tests/qemuxml2argvdata/disk-discard.args b/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args
similarity index 59%
rename from tests/qemuxml2argvdata/disk-discard.args
rename to tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args
index 163b1b0df2..4437922eee 100644
--- a/tests/qemuxml2argvdata/disk-discard.args
+++ b/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args
@@ -8,29 +8,33 @@ XDG_CACHE_HOME=/tmp/lib/domain--1-test/.cache \
 XDG_CONFIG_HOME=/tmp/lib/domain--1-test/.config \
 QEMU_AUDIO_DRV=none \
 /usr/bin/qemu-system-x86_64 \
--name test \
+-name guest=test,debug-threads=on \
 -S \
--machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-test/master-key.aes \
+-machine pc-i440fx-4.1,accel=tcg,usb=off,dump-guest-core=off \
 -m 1024 \
--realtime mlock=off \
+-overcommit mem-lock=off \
 -smp 1,sockets=1,cores=1,threads=1 \
 -uuid 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e \
 -display none \
 -no-user-config \
 -nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-test/monitor.sock,\
-server,nowait \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=control \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--boot menu=on \
--usb \
+-boot menu=on,strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -drive file=/var/lib/libvirt/images/f14.img,format=qcow2,if=none,\
 id=drive-virtio-disk0,discard=unmap \
--device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
 id=virtio-disk0,bootindex=2 \
 -drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,format=raw,if=none,\
 id=drive-ide0-1-0,readonly=on,discard=ignore \
 -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-discard.x86_64-latest.args b/tests/qemuxml2argvdata/disk-discard.x86_64-latest.args
new file mode 100644
index 0000000000..a7cbf567c8
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-discard.x86_64-latest.args
@@ -0,0 +1,46 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-test \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-test/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-test/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-test/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=test,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-test/master-key.aes \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-cpu qemu64 \
+-m 1024 \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot menu=on,strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/f14.img",\
+"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap",\
+"driver":"qcow2","file":"libvirt-2-storage"}' \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=libvirt-2-format,\
+id=virtio-disk0,bootindex=2 \
+-blockdev '{"driver":"file",\
+"filename":"/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso",\
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-1-format","read-only":true,"discard":"ignore",\
+"driver":"raw","file":"libvirt-1-storage"}' \
+-device ide-cd,bus=ide.1,unit=0,drive=libvirt-1-format,id=ide0-1-0,bootindex=1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ff33870581..f45f04548f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1135,11 +1135,8 @@ mymain(void)
             QEMU_CAPS_VIRTIO_BLK_SCSI);
     DO_TEST_CAPS_VER("disk-copy_on_read", "2.12.0");
     DO_TEST_CAPS_LATEST("disk-copy_on_read");
-    DO_TEST("disk-discard",
-            QEMU_CAPS_DRIVE_DISCARD);
-    DO_TEST("disk-detect-zeroes",
-            QEMU_CAPS_DRIVE_DISCARD,
-            QEMU_CAPS_DRIVE_DETECT_ZEROES);
+    DO_TEST_CAPS_VER("disk-discard", "4.1.0");
+    DO_TEST_CAPS_LATEST("disk-discard");
     DO_TEST_CAPS_VER("disk-detect-zeroes", "2.12.0");
     DO_TEST_CAPS_LATEST("disk-detect-zeroes");
     DO_TEST("disk-snapshot", NONE);
diff --git a/tests/qemuxml2xmloutdata/disk-detect-zeroes.xml b/tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml
similarity index 100%
rename from tests/qemuxml2xmloutdata/disk-detect-zeroes.xml
rename to tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml
diff --git a/tests/qemuxml2xmloutdata/disk-discard.xml b/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml
similarity index 87%
rename from tests/qemuxml2xmloutdata/disk-discard.xml
rename to tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml
index 563a24ae04..e55c5bf6d3 100644
--- a/tests/qemuxml2xmloutdata/disk-discard.xml
+++ b/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml
@@ -10,6 +10,9 @@
     <boot dev='hd'/>
     <bootmenu enable='yes'/>
   </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
@@ -29,7 +32,7 @@
       <readonly/>
       <address type='drive' controller='0' bus='1' target='0' unit='0'/>
     </disk>
-    <controller type='usb' index='0'>
+    <controller type='usb' index='0' model='piix3-uhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>
     <controller type='ide' index='0'>
@@ -39,7 +42,7 @@
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <memballoon model='virtio'>
-      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
     </memballoon>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 8bfa23cddf..34a9f2803a 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -638,8 +638,8 @@ mymain(void)
     DO_TEST("disk-source-pool", NONE);
     DO_TEST("disk-source-pool-mode", NONE);

-    DO_TEST("disk-discard", NONE);
-    DO_TEST("disk-detect-zeroes", NONE);
+    DO_TEST_CAPS_LATEST("disk-discard");
+    DO_TEST_CAPS_LATEST("disk-detect-zeroes");

     DO_TEST("disk-serial", NONE);

-- 
2.26.2





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux