Skip to content

blkio/virtio_blk: overwrite read-only if F_RO is negotiated

We required the user to set the "read-only" property to true if the virtio-blk device was read-only (VIRTIO_BLK_F_RO negotiated). But as Rich reported [1], the user has no way of knowing if the device is read-only.

Let's fix this issue by overwriting the "read-only" property during the connect if VIRTIO_BLK_F_RO is negotiated. This way the property reflects the device (is no longer required to be set to true by the user if the device is RO), but also allows the old behavior (allowing the user to use a RW device in read-only mode).

[1] https://listman.redhat.com/archives/libguestfs/2023-January/030468.html

Reported-by: Richard W.M. Jones rjones@redhat.com Signed-off-by: Stefano Garzarella sgarzare@redhat.com

Merge request reports