From 6862969cf8c9e3a7c0636e7c1a220fe65014155d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Mon, 19 May 2025 18:20:57 +0200 Subject: [PATCH] qemu: forbid readonly attribute for externally launched virtiofsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In that case, libvirtd cannot set it on the command line because virtiofsd is not launched by libvirt. https://issues.redhat.com/browse/RHEL-87522 Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 6 +++ ...st-user-fs-sock-readonly.x86_64-latest.err | 1 + .../vhost-user-fs-sock-readonly.xml | 41 +++++++++++++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 49 insertions(+) create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.x86_64-latest.err create mode 100644 tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.xml diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 3e8fdb2268..3b0f2b50a5 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -5022,6 +5022,12 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs, _("virtiofs does not support wrpolicy")); return -1; } + } else { + if (fs->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("readonly mode cannot be set for externally started virtiofsd")); + return -1; + } } if (fs->model != VIR_DOMAIN_FS_MODEL_DEFAULT) { diff --git a/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.x86_64-latest.err b/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.x86_64-latest.err new file mode 100644 index 0000000000..d6df9bddb8 --- /dev/null +++ b/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: readonly mode cannot be set for externally started virtiofsd diff --git a/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.xml b/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.xml new file mode 100644 index 0000000000..39e27ccfba --- /dev/null +++ b/tests/qemuxmlconfdata/vhost-user-fs-sock-readonly.xml @@ -0,0 +1,41 @@ + + guest + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + 2 + + hvm + + + + qemu64 + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + +
+ + + +