On Thu, Nov 19, 2026 at 15:24:03 +0100, Peter Krempa wrote:
From: Peter Krempa <pkrempa@redhat.com>
QEMU when instantiating a 'host_device' blockdev backend performs checks to ensure that the device is actually writable (per host's kernel) when the device is to be opened in read-write mode.
For configurations where the storage is marked as read-only while waiting for failover which happens at guest OS level this would prevent the start of the failover VM which is waiting for the primary one to fail as it wouldn't be able to open the device in read-write mode and then perform failover later during runtime.
QEMU introduced a new property 'accept-read-only-device' for the 'host-device' backend, so libvirt needs to expose it to users.
Signed-off-by: Peter Krempa <pipo@pipo.sk> --- docs/formatdomain.rst | 7 +++++++ src/conf/domain_conf.c | 13 +++++++++++++ src/conf/schemas/domaincommon.rng | 5 +++++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 3 +++ src/qemu/qemu_block.c | 4 ++++ src/qemu/qemu_domain.c | 8 ++++++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.args | 4 ++++ tests/qemuxmlconfdata/disk-misc.x86_64-latest.xml | 12 ++++++++++++ tests/qemuxmlconfdata/disk-misc.xml | 10 ++++++++++ 10 files changed, 67 insertions(+) ... diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 010b44ccb0..23081cd140 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -822,6 +822,7 @@ virStorageSourceCopy(const virStorageSource *src, def->timeout = src->timeout; def->reconnectDelay = src->reconnectDelay; def->metadataCacheMaxSize = src->metadataCacheMaxSize; + def->block_accept_readonly_dev = src->block_accept_readonly_dev;
/* storage driver metadata are not copied */ def->drv = NULL; diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index fa71a9ef39..fb955b6bdc 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -284,6 +284,9 @@ struct _virStorageSource { virStorageType type; char *path; char *fdgroup; /* name of group of file descriptors the user wishes to use instead of 'path' */ + virTristateBool block_accept_readonly_dev; /* hypervisor should open device regardless + of if the kernel considers it read-only in + read-write mode */
The comment is not very clear to me. How about hypervisor should open the device in read-write mode even if the kernel considers it read-only
virStorageNetProtocol protocol; char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>