1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

qemuxml2(argv|xml): Modernize 'discard'/'detect-zero' tests

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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2020-05-04 18:53:31 +02:00
parent 1071bda21f
commit 8ddd7d840f
8 changed files with 73 additions and 19 deletions

View File

@ -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 \

View File

@ -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'>

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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>

View File

@ -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);