From 62b0be5fdada98c4181ef6447419de6388df6569 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 22 Sep 2021 10:41:52 +0200 Subject: [PATCH] qemuxml2argvtest: Modernize outstanding disk-backend related tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For backend related tests we need to cover the pre-blockdev and post-blockdev era, so the fake-capability test is converted to a combination of DO_TEST_CAPS_VER(..., "4.1.0") and DO_TEST_CAPS_LATEST. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- ...w.args => disk-fmt-qcow.x86_64-4.1.0.args} | 9 ++-- .../disk-fmt-qcow.x86_64-latest.args | 38 +++++++++++++++ ...> disk-source-pool-mode.x86_64-4.1.0.args} | 9 ++-- .../disk-source-pool-mode.x86_64-latest.args | 45 ++++++++++++++++++ ...rgs => disk-source-pool.x86_64-4.1.0.args} | 13 +++--- .../disk-source-pool.x86_64-latest.args | 46 +++++++++++++++++++ tests/qemuxml2argvtest.c | 9 ++-- 7 files changed, 152 insertions(+), 17 deletions(-) rename tests/qemuxml2argvdata/{disk-fmt-qcow.args => disk-fmt-qcow.x86_64-4.1.0.args} (77%) create mode 100644 tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-latest.args rename tests/qemuxml2argvdata/{disk-source-pool-mode.args => disk-source-pool-mode.x86_64-4.1.0.args} (84%) create mode 100644 tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-latest.args rename tests/qemuxml2argvdata/{disk-source-pool.args => disk-source-pool.x86_64-4.1.0.args} (73%) create mode 100644 tests/qemuxml2argvdata/disk-source-pool.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/disk-fmt-qcow.args b/tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-4.1.0.args similarity index 77% rename from tests/qemuxml2argvdata/disk-fmt-qcow.args rename to tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-4.1.0.args index aa284c1e15..fe8ce7326d 100644 --- a/tests/qemuxml2argvdata/disk-fmt-qcow.args +++ b/tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-4.1.0.args @@ -11,23 +11,24 @@ QEMU_AUDIO_DRV=none \ -name guest=QEMUGuest1,debug-threads=on \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-machine pc-i440fx-4.1,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ --realtime mlock=off \ +-overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -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=on,wait=off \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ -no-acpi \ -boot strict=on \ --usb \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0 \ -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-1-0,readonly=on \ -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-latest.args b/tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-latest.args new file mode 100644 index 0000000000..afdfc94c27 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-fmt-qcow.x86_64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage"}' \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-2-format,id=ide0-0-0,bootindex=1 \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ +-device ide-cd,bus=ide.1,unit=0,drive=libvirt-1-format,id=ide0-1-0 \ +-audiodev id=audio1,driver=none \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-source-pool-mode.args b/tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-4.1.0.args similarity index 84% rename from tests/qemuxml2argvdata/disk-source-pool-mode.args rename to tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-4.1.0.args index f4f4a72a2a..dce39132fa 100644 --- a/tests/qemuxml2argvdata/disk-source-pool-mode.args +++ b/tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-4.1.0.args @@ -11,21 +11,21 @@ QEMU_AUDIO_DRV=none \ -name guest=QEMUGuest1,debug-threads=on \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-machine pc-i440fx-4.1,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ --realtime mlock=off \ +-overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -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=on,wait=off \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ -no-acpi \ -boot strict=on \ --usb \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -drive file=/some/block/device/unit:0:0:1,format=raw,if=none,id=drive-ide0-0-1,readonly=on \ -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \ -drive file.driver=iscsi,file.portal=iscsi.example.com:3260,file.target=demo-target,file.lun=2,file.transport=tcp,format=raw,if=none,id=drive-ide0-0-2,readonly=on \ @@ -35,4 +35,5 @@ QEMU_AUDIO_DRV=none \ -drive file.driver=iscsi,file.portal=iscsi.example.com:3260,file.target=demo-target,file.lun=3,file.transport=tcp,format=raw,if=none,id=drive-ide0-0-4,readonly=on \ -device ide-cd,bus=ide.0,unit=4,drive=drive-ide0-0-4,id=ide0-0-4 \ -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-source-pool-mode.x86_64-latest.args b/tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-latest.args new file mode 100644 index 0000000000..a72147cb7f --- /dev/null +++ b/tests/qemuxml2argvdata/disk-source-pool-mode.x86_64-latest.args @@ -0,0 +1,45 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/some/block/device/unit:0:0:1","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-4-format","read-only":true,"driver":"raw","file":"libvirt-4-storage"}' \ +-device ide-cd,bus=ide.0,unit=1,drive=libvirt-4-format,id=ide0-0-1 \ +-blockdev '{"driver":"iscsi","portal":"iscsi.example.com:3260","target":"demo-target","lun":2,"transport":"tcp","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"raw","file":"libvirt-3-storage"}' \ +-device ide-cd,bus=ide.0,unit=2,drive=libvirt-3-format,id=ide0-0-2 \ +-blockdev '{"driver":"file","filename":"/tmp/idedisk.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}' \ +-device ide-hd,bus=ide.0,unit=3,drive=libvirt-2-format,id=ide0-0-3,bootindex=1 \ +-blockdev '{"driver":"iscsi","portal":"iscsi.example.com:3260","target":"demo-target","lun":3,"transport":"tcp","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ +-device ide-cd,bus=ide.0,unit=4,drive=libvirt-1-format,id=ide0-0-4 \ +-audiodev id=audio1,driver=none \ +-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-source-pool.args b/tests/qemuxml2argvdata/disk-source-pool.x86_64-4.1.0.args similarity index 73% rename from tests/qemuxml2argvdata/disk-source-pool.args rename to tests/qemuxml2argvdata/disk-source-pool.x86_64-4.1.0.args index fe97765783..4779ee065b 100644 --- a/tests/qemuxml2argvdata/disk-source-pool.args +++ b/tests/qemuxml2argvdata/disk-source-pool.x86_64-4.1.0.args @@ -11,21 +11,21 @@ QEMU_AUDIO_DRV=none \ -name guest=QEMUGuest1,debug-threads=on \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-machine pc-i440fx-4.1,accel=tcg,usb=off,dump-guest-core=off \ -m 214 \ --realtime mlock=off \ +-overcommit mem-lock=off \ -smp 1,sockets=1,cores=1,threads=1 \ -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=on,wait=off \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ -mon chardev=charmonitor,id=monitor,mode=control \ -rtc base=utc \ -no-shutdown \ -no-acpi \ -boot strict=on \ --usb \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -drive file=/some/block/device/cdrom,format=raw,if=none,id=drive-ide0-0-1,readonly=on \ -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \ -drive if=none,id=drive-ide0-1-0,readonly=on \ @@ -33,8 +33,9 @@ QEMU_AUDIO_DRV=none \ -drive file=/tmp/idedisk.img,format=raw,if=none,id=drive-ide0-0-2 \ -device ide-hd,bus=ide.0,unit=2,drive=drive-ide0-0-2,id=ide0-0-2,bootindex=1 \ -drive file=fat:/some/dir/device/vol1,if=none,id=drive-virtio-disk0,readonly=on \ --device virtio-blk-pci,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,id=virtio-disk0 \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,id=virtio-disk0 \ -drive file=fat:/some/dir/device/vol2,if=none,id=drive-virtio-disk1,readonly=on \ --device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-source-pool.x86_64-latest.args b/tests/qemuxml2argvdata/disk-source-pool.x86_64-latest.args new file mode 100644 index 0000000000..a48af2689c --- /dev/null +++ b/tests/qemuxml2argvdata/disk-source-pool.x86_64-latest.args @@ -0,0 +1,46 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-i386 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-blockdev '{"driver":"host_device","filename":"/some/block/device/cdrom","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-5-format","read-only":true,"driver":"raw","file":"libvirt-5-storage"}' \ +-device ide-cd,bus=ide.0,unit=1,drive=libvirt-5-format,id=ide0-0-1 \ +-device ide-cd,bus=ide.1,unit=0,id=ide0-1-0 \ +-blockdev '{"driver":"file","filename":"/tmp/idedisk.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}' \ +-device ide-hd,bus=ide.0,unit=2,drive=libvirt-3-format,id=ide0-0-2,bootindex=1 \ +-blockdev '{"driver":"vvfat","dir":"/some/dir/device/vol1","floppy":false,"rw":false,"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"raw","file":"libvirt-2-storage"}' \ +-device virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-2-format,id=virtio-disk0 \ +-blockdev '{"driver":"vvfat","dir":"/some/dir/device/vol2","floppy":false,"rw":false,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":true,"driver":"raw","file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=libvirt-1-format,id=virtio-disk1 \ +-audiodev id=audio1,driver=none \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index bfa41a2f81..95e26c2a17 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1322,7 +1322,8 @@ mymain(void) DO_TEST_CAPS_LATEST("floppy-drive-fat"); DO_TEST_CAPS_VER("disk-readonly-disk", "2.12.0"); DO_TEST_CAPS_LATEST("disk-readonly-disk"); - DO_TEST_NOCAPS("disk-fmt-qcow"); + DO_TEST_CAPS_VER("disk-fmt-qcow", "4.1.0"); + DO_TEST_CAPS_LATEST("disk-fmt-qcow"); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-fmt-cow"); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-fmt-dir"); DO_TEST_CAPS_LATEST_PARSE_ERROR("disk-fmt-iso"); @@ -1386,8 +1387,10 @@ mymain(void) DO_TEST_CAPS_VER("disk-aio", "2.12.0"); DO_TEST_CAPS_LATEST("disk-aio"); DO_TEST_CAPS_LATEST("disk-aio-io_uring"); - DO_TEST_NOCAPS("disk-source-pool"); - DO_TEST_NOCAPS("disk-source-pool-mode"); + DO_TEST_CAPS_VER("disk-source-pool", "4.1.0"); + DO_TEST_CAPS_LATEST("disk-source-pool"); + DO_TEST_CAPS_VER("disk-source-pool-mode", "4.1.0"); + DO_TEST_CAPS_LATEST("disk-source-pool-mode"); DO_TEST_CAPS_LATEST("disk-ioeventfd"); DO_TEST_CAPS_VER("disk-copy_on_read", "2.12.0"); DO_TEST_CAPS_LATEST("disk-copy_on_read");