From f28807a1e0dafea25a7871a21ad12200b85dcdba Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 8 Nov 2022 08:40:07 +0100 Subject: [PATCH] qemu: Assume QEMU_CAPS_DISK_WRITE_CACHE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduced in QEMU's commit of v2.7.0-rc0~32^2~5 the .write-cache attribute of virtio-blk dvice is always available for all QEMU versions we support (4.2.0, currently). Therefore, we can assume the capability is always set and thus doesn't need to be checked for. The change in some .args is justified, because the qemuxml2argvdatatest runs these test caseses with very minimalistic set of capabilities, that's nowhere near real life scenario. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_command.c | 3 +-- tests/qemuxml2argvdata/controller-order.args | 2 +- tests/qemuxml2argvdata/video-device-pciaddr-default.args | 2 +- tests/qemuxml2argvdata/video-qxl-device-vgamem.args | 2 +- tests/qemuxml2argvdata/video-qxl-device.args | 2 +- tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.args | 2 +- tests/qemuxml2argvdata/video-qxl-sec-device.args | 2 +- tests/qemuxml2argvdata/video-vga-device-vgamem.args | 2 +- tests/qemuxml2argvdata/video-vga-device.args | 2 +- tests/qemuxml2argvdata/video-virtio-gpu-device.args | 2 +- tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args | 2 +- tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.args | 2 +- tests/qemuxml2argvdata/video-virtio-gpu-virgl.args | 2 +- tests/qemuxml2argvdata/video-virtio-vga.args | 2 +- 14 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f775170e32..3236196c14 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1900,8 +1900,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, if (disk->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { /* VIR_DOMAIN_DISK_DEVICE_LUN translates into 'scsi-block' * where any caching setting makes no sense. */ - if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISK_WRITE_CACHE)) { + if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) { bool wb; if (qemuDomainDiskCachemodeFlags(disk->cachemode, &wb, NULL, diff --git a/tests/qemuxml2argvdata/controller-order.args b/tests/qemuxml2argvdata/controller-order.args index c0ba064bec..242639591c 100644 --- a/tests/qemuxml2argvdata/controller-order.args +++ b/tests/qemuxml2argvdata/controller-order.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-fdr/.config \ -device usb-ccid,id=ccid0,bus=usb.0,port=1.1 \ -blockdev '{"driver":"file","filename":"/tmp/fdr.img","aio":"native","node-name":"libvirt-2-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-2-storage"}' \ --device virtio-blk-pci,bus=pci.0,addr=0x5,share-rw=on,drive=libvirt-2-format,id=virtio-disk0,bootindex=1 \ +-device virtio-blk-pci,bus=pci.0,addr=0x5,share-rw=on,drive=libvirt-2-format,id=virtio-disk0,bootindex=1,write-cache=on \ -blockdev '{"driver":"file","filename":"/tmp/Fedora-17-x86_64-Live-Desktop.iso","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 \ diff --git a/tests/qemuxml2argvdata/video-device-pciaddr-default.args b/tests/qemuxml2argvdata/video-device-pciaddr-default.args index e216aacc64..9b421c012d 100644 --- a/tests/qemuxml2argvdata/video-device-pciaddr-default.args +++ b/tests/qemuxml2argvdata/video-device-pciaddr-default.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -vnc 127.0.0.1:0,audiodev=audio1 \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-qxl-device-vgamem.args b/tests/qemuxml2argvdata/video-qxl-device-vgamem.args index 1332f798da..14b3931140 100644 --- a/tests/qemuxml2argvdata/video-qxl-device-vgamem.args +++ b/tests/qemuxml2argvdata/video-qxl-device-vgamem.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-qxl-device.args b/tests/qemuxml2argvdata/video-qxl-device.args index dc679b7aa5..570bb64323 100644 --- a/tests/qemuxml2argvdata/video-qxl-device.args +++ b/tests/qemuxml2argvdata/video-qxl-device.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.args b/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.args index 42de87528c..1715ee0cf7 100644 --- a/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.args +++ b/tests/qemuxml2argvdata/video-qxl-sec-device-vgamem.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x2 \ -device qxl,id=video1,max_outputs=1,ram_size=67108864,vram_size=67108864,vgamem_mb=16,bus=pci.0,addr=0x4 \ diff --git a/tests/qemuxml2argvdata/video-qxl-sec-device.args b/tests/qemuxml2argvdata/video-qxl-sec-device.args index c55e3eb9db..6140fffa72 100644 --- a/tests/qemuxml2argvdata/video-qxl-sec-device.args +++ b/tests/qemuxml2argvdata/video-qxl-sec-device.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device qxl-vga,id=video0,max_outputs=1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 \ -device qxl,id=video1,max_outputs=1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \ diff --git a/tests/qemuxml2argvdata/video-vga-device-vgamem.args b/tests/qemuxml2argvdata/video-vga-device-vgamem.args index 8d1108216e..c9ac626b77 100644 --- a/tests/qemuxml2argvdata/video-vga-device-vgamem.args +++ b/tests/qemuxml2argvdata/video-vga-device-vgamem.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-vga-device.args b/tests/qemuxml2argvdata/video-vga-device.args index 1a832df4cb..10f3b38e09 100644 --- a/tests/qemuxml2argvdata/video-vga-device.args +++ b/tests/qemuxml2argvdata/video-vga-device.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device VGA,id=video0,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-device.args b/tests/qemuxml2argvdata/video-virtio-gpu-device.args index 1dd818f5fc..2c31631572 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-device.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-device.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device virtio-gpu-pci,id=video0,max_outputs=1,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args index d4ab9fac16..adeab6d53d 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-sdl-gl.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -display sdl,gl=on \ -device virtio-gpu-pci,id=video0,virgl=on,max_outputs=1,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.args b/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.args index f198d4da8b..60862a48d7 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-spice-gl.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"spice"}' \ -spice port=0,gl=on,rendernode=/dev/dri/foo,seamless-migration=on \ -device virtio-gpu-pci,id=video0,virgl=on,max_outputs=1,bus=pci.0,addr=0x2 \ diff --git a/tests/qemuxml2argvdata/video-virtio-gpu-virgl.args b/tests/qemuxml2argvdata/video-virtio-gpu-virgl.args index 140bee6187..87c79a4865 100644 --- a/tests/qemuxml2argvdata/video-virtio-gpu-virgl.args +++ b/tests/qemuxml2argvdata/video-virtio-gpu-virgl.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device virtio-gpu-pci,id=video0,virgl=on,max_outputs=1,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ diff --git a/tests/qemuxml2argvdata/video-virtio-vga.args b/tests/qemuxml2argvdata/video-virtio-vga.args index 704a6334b0..f0352d7583 100644 --- a/tests/qemuxml2argvdata/video-virtio-vga.args +++ b/tests/qemuxml2argvdata/video-virtio-vga.args @@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -usb \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/QEMUGuest1","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \ +-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1,write-cache=on \ -audiodev '{"id":"audio1","driver":"none"}' \ -device virtio-vga,id=video0,max_outputs=1,bus=pci.0,addr=0x2 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \