From: Peter Krempa Date: Mon, 4 May 2020 16:53:31 +0000 (+0200) Subject: qemuxml2(argv|xml): Modernize 'discard'/'detect-zero' tests X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8ddd7d840fa825cb1b1e18f689790f7b4c1441f3;p=libvirt.git 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 Reviewed-by: Michal Privoznik --- 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 @@ + + qemu64 + destroy restart @@ -29,7 +32,7 @@
- +
diff --git a/tests/qemuxml2argvdata/disk-discard.args b/tests/qemuxml2argvdata/disk-discard.args deleted file mode 100644 index 163b1b0df2..0000000000 --- a/tests/qemuxml2argvdata/disk-discard.args +++ /dev/null @@ -1,36 +0,0 @@ -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 test \ --S \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ --m 1024 \ --realtime mlock=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 \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot menu=on \ --usb \ --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,\ -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 diff --git a/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args b/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args new file mode 100644 index 0000000000..4437922eee --- /dev/null +++ b/tests/qemuxml2argvdata/disk-discard.x86_64-4.1.0.args @@ -0,0 +1,40 @@ +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-i440fx-4.1,accel=tcg,usb=off,dump-guest-core=off \ +-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 \ +-drive file=/var/lib/libvirt/images/f14.img,format=qcow2,if=none,\ +id=drive-virtio-disk0,discard=unmap \ +-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=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.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml new file mode 120000 index 0000000000..17a520c4d4 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-detect-zeroes.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/disk-detect-zeroes.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/disk-detect-zeroes.xml b/tests/qemuxml2xmloutdata/disk-detect-zeroes.xml deleted file mode 120000 index 17a520c4d4..0000000000 --- a/tests/qemuxml2xmloutdata/disk-detect-zeroes.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/disk-detect-zeroes.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml new file mode 100644 index 0000000000..e55c5bf6d3 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-discard.x86_64-latest.xml @@ -0,0 +1,48 @@ + + test + 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e + 1048576 + 1048576 + 1 + + hvm + + + + + + qemu64 + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + + + +
+ + +
+ + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/disk-discard.xml b/tests/qemuxml2xmloutdata/disk-discard.xml deleted file mode 100644 index 563a24ae04..0000000000 --- a/tests/qemuxml2xmloutdata/disk-discard.xml +++ /dev/null @@ -1,45 +0,0 @@ - - test - 92d7a226-cfae-425b-a6d3-00bbf9ec5c9e - 1048576 - 1048576 - 1 - - hvm - - - - - - destroy - restart - restart - - /usr/bin/qemu-system-x86_64 - - - - -
- - - - - - -
- - -
- - -
- - - - - -
- - - 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);