From 13ee4fc8593f4c247a65448b9c746643ce5d3c0c Mon Sep 17 00:00:00 2001 From: Stefan Hrdlicka Date: Wed, 1 Mar 2023 13:13:25 +0100 Subject: [PATCH] fix #2920: cifs: add options parameter 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 [FE: rebase + style fixes] Signed-off-by: Fiona Ebner Tested-by: Friedrich Weber [T: fix merge conflict ] Signed-off-by: Thomas Lamprecht --- src/PVE/Storage/CIFSPlugin.pm | 4 +++- src/PVE/Storage/NFSPlugin.pm | 4 ---- src/PVE/Storage/Plugin.pm | 6 ++++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PVE/Storage/CIFSPlugin.pm b/src/PVE/Storage/CIFSPlugin.pm index e40641a..71b85aa 100644 --- a/src/PVE/Storage/CIFSPlugin.pm +++ b/src/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"); } @@ -154,6 +155,7 @@ sub options { 'create-subdirs' => { optional => 1 }, bwlimit => { optional => 1 }, preallocation => { optional => 1 }, + options => { optional => 1 }, }; } diff --git a/src/PVE/Storage/NFSPlugin.pm b/src/PVE/Storage/NFSPlugin.pm index 6e92bdd..f2e4c0d 100644 --- a/src/PVE/Storage/NFSPlugin.pm +++ b/src/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/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index f6295ed..727b7a6 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -192,6 +192,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, + }, }, };