[libvirt PATCH] qemu: forbid readonly attribute for externally launched virtiofsd

Ján Tomko via Devel posted 1 patch 3 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/43ba1403d6e0d7430fadb3949d53f5f5230cfa0f.1747671764.git.jtomko@redhat.com
src/qemu/qemu_validate.c | 5 +++++
1 file changed, 5 insertions(+)
[libvirt PATCH] qemu: forbid readonly attribute for externally launched virtiofsd
Posted by Ján Tomko via Devel 3 months, 3 weeks ago
From: Ján Tomko <jtomko@redhat.com>

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 <jtomko@redhat.com>
---
 src/qemu/qemu_validate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 87588024ce..013ff14d75 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4684,6 +4684,11 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
                                _("virtiofs does not support wrpolicy"));
                 return -1;
             }
+            if (fs->readonly) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("readonly mode cannot be set for extrenally started virtiofsd"));
+                return -1;
+            }
         }
 
         if (fs->model != VIR_DOMAIN_FS_MODEL_DEFAULT) {
-- 
2.49.0
Re: [libvirt PATCH] qemu: forbid readonly attribute for externally launched virtiofsd
Posted by Michal Prívozník via Devel 3 months, 3 weeks ago
On 5/19/25 18:22, Ján Tomko via Devel wrote:
> From: Ján Tomko <jtomko@redhat.com>
> 
> 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 <jtomko@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 87588024ce..013ff14d75 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -4684,6 +4684,11 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
>                                 _("virtiofs does not support wrpolicy"));
>                  return -1;
>              }
> +            if (fs->readonly) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                               _("readonly mode cannot be set for extrenally started virtiofsd"));
> +                return -1;
> +            }

Isn't this backwards? I mean, this block starts with:

        if (!fs->sock) {

which means the virtiofsd is launched by libvirt. Not to mention, with
this patch applied there's at least one test failing (qemuxmlconftest).

I think I need to see v2 before giving you my ACK.

Michal
Re: [libvirt PATCH] qemu: forbid readonly attribute for externally launched virtiofsd
Posted by Daniel P. Berrangé via Devel 3 months, 3 weeks ago
On Mon, May 19, 2025 at 06:22:44PM +0200, Ján Tomko via Devel wrote:
> From: Ján Tomko <jtomko@redhat.com>
> 
> 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 <jtomko@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 87588024ce..013ff14d75 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -4684,6 +4684,11 @@ qemuValidateDomainDeviceDefFS(virDomainFSDef *fs,
>                                 _("virtiofs does not support wrpolicy"));
>                  return -1;
>              }
> +            if (fs->readonly) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                               _("readonly mode cannot be set for extrenally started virtiofsd"));

s/extrenally/externally/

> +                return -1;
> +            }
>          }

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|