[PATCH 43/48] qemu: Assume QEMU_CAPS_DISK_SHARE_RW

Michal Privoznik posted 48 patches 3 years, 3 months ago
[PATCH 43/48] qemu: Assume QEMU_CAPS_DISK_SHARE_RW
Posted by Michal Privoznik 3 years, 3 months ago
Introduced in QEMU's commit of v2.9.0-rc0~48^2~25 the .share-rw
attribute of virtio-blk device 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 controller-order.args is justified, because the
qemuxml2argvdatatest runs the test case with very minimalistic
set of capabilities, that's nowhere near real life scenario.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_command.c                      | 3 +--
 tests/qemuxml2argvdata/controller-order.args | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b0c9fb7059..f775170e32 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1871,8 +1871,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
     if (qemuBuildDeviceAddressProps(props, def, &disk->info) < 0)
         return NULL;
 
-    if (disk->src->shared &&
-        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISK_SHARE_RW))
+    if (disk->src->shared)
         shareRW = VIR_TRISTATE_SWITCH_ON;
 
     if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) {
diff --git a/tests/qemuxml2argvdata/controller-order.args b/tests/qemuxml2argvdata/controller-order.args
index fd9eba459a..c0ba064bec 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,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 \
 -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 \
-- 
2.37.4
Re: [PATCH 43/48] qemu: Assume QEMU_CAPS_DISK_SHARE_RW
Posted by Ján Tomko 3 years, 3 months ago
On a Tuesday in 2022, Michal Privoznik wrote:
>Introduced in QEMU's commit of v2.9.0-rc0~48^2~25 the .share-rw
>attribute of virtio-blk device 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 controller-order.args is justified, because the
>qemuxml2argvdatatest runs the test case with very minimalistic
>set of capabilities, that's nowhere near real life scenario.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_command.c                      | 3 +--
> tests/qemuxml2argvdata/controller-order.args | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano