[pve-devel] [PATCH qemu-server v1 3/11] virtiofs: add readonly option

Markus Frank m.frank at proxmox.com
Mon Oct 20 14:17:38 CEST 2025


Signed-off-by: Markus Frank <m.frank at proxmox.com>
---
 src/PVE/QemuServer/Virtiofs.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/QemuServer/Virtiofs.pm b/src/PVE/QemuServer/Virtiofs.pm
index ee6cee33..b820ad27 100644
--- a/src/PVE/QemuServer/Virtiofs.pm
+++ b/src/PVE/QemuServer/Virtiofs.pm
@@ -47,6 +47,12 @@ my $virtiofs_fmt = {
         default => 0,
         optional => 1,
     },
+    'readonly' => {
+        type => 'boolean',
+        description => "Prevent write accesses from the guest.",
+        default => 0,
+        optional => 1,
+    },
     'expose-xattr' => {
         type => 'boolean',
         description => "Enable support for extended attributes for this mount.",
@@ -192,6 +198,7 @@ sub start_virtiofsd {
                 if $virtiofs->{'thread-pool-size'};
             push @$cmd, '--announce-submounts';
             push @$cmd, '--allow-direct-io' if $virtiofs->{'direct-io'};
+            push @$cmd, '--readonly' if $virtiofs->{readonly};
             push @$cmd, '--cache=' . $virtiofs->{cache} if $virtiofs->{cache};
             push @$cmd, '--inode-file-handles=prefer' if $prefer_inode_fh;
             push @$cmd, '--syslog';
-- 
2.47.3





More information about the pve-devel mailing list