[pve-devel] [PATCH v3 storage 1/1] fix #2920: cifs: add options parameter

Fiona Ebner f.ebner at proxmox.com
Wed Mar 1 13:13:25 CET 2023


From: Stefan Hrdlicka <s.hrdlicka at proxmox.com>

This makes it possible to add all mount options offered by mount.cifs.
NFS & CIFS now share the options parameter since they use it for the
same purpose.

Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
[FE: rebase + style fixes]
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

Changes from v2:
    * minor improvements in commit message
    * adapt to recently changed cifs_mount function interface

 PVE/Storage/CIFSPlugin.pm | 4 +++-
 PVE/Storage/NFSPlugin.pm  | 4 ----
 PVE/Storage/Plugin.pm     | 6 ++++++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm
index 6e20f4b..996ef44 100644
--- a/PVE/Storage/CIFSPlugin.pm
+++ b/PVE/Storage/CIFSPlugin.pm
@@ -69,7 +69,7 @@ sub get_cred_file {
 sub cifs_mount : prototype($$$$$) {
     my ($scfg, $storeid, $smbver, $user, $domain) = @_;
 
-    my ($mountpoint, $server, $share) = $scfg->@{'path', 'server', 'share'};
+    my ($mountpoint, $server, $share, $options) = $scfg->@{'path', 'server', 'share', 'options'};
     my $subdir = $scfg->{subdir} // "/";
 
     $server = "[$server]" if Net::IP::ip_is_ipv6($server);
@@ -85,6 +85,7 @@ sub cifs_mount : prototype($$$$$) {
     }
 
     push @$cmd, '-o', defined($smbver) ? "vers=$smbver" : "vers=default";
+    push @$cmd, '-o', $options if $options;
 
     run_command($cmd, errmsg => "mount error");
 }
@@ -152,6 +153,7 @@ sub options {
 	mkdir => { optional => 1 },
 	bwlimit => { optional => 1 },
 	preallocation => { optional => 1 },
+	options => { optional => 1 },
     };
 }
 
diff --git a/PVE/Storage/NFSPlugin.pm b/PVE/Storage/NFSPlugin.pm
index c2d4176..54423cd 100644
--- a/PVE/Storage/NFSPlugin.pm
+++ b/PVE/Storage/NFSPlugin.pm
@@ -69,10 +69,6 @@ sub properties {
 	    description => "Server IP or DNS name.",
 	    type => 'string', format => 'pve-storage-server',
 	},
-	options => {
-	    description => "NFS mount options (see 'man nfs')",
-	    type => 'string',  format => 'pve-storage-options',
-	},
     };
 }
 
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index ca7a0d4..d08c8aa 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -191,6 +191,12 @@ my $defaultData = {
 	    type => "string", format => "pve-dir-override-list",
 	    optional => 1,
 	},
+	options => {
+	    description => "NFS/CIFS mount options (see 'man nfs' or 'man mount.cifs')",
+	    type => 'string',
+	    format => 'pve-storage-options',
+	    optional => 1,
+	},
     },
 };
 
-- 
2.30.2






More information about the pve-devel mailing list