[pve-devel] [PATCH v2 container 1/2] fix #1451: add mountoptions to container config
Oguz Bektas
o.bektas at proxmox.com
Tue May 21 10:47:59 CEST 2019
adds a mountoptions parameter in container config, which allows
passing arbitrary mount options for the mountpoints and the rootfs.
the format is such:
mountoptions=option;option;option;...
for example:
mp0: local-lvm:vm-1500-disk-1,mp=/etc/test1,mountoptions=strictatime;noexec;nodev,quota=1,size=8G
Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
src/PVE/LXC.pm | 12 ++++++++++--
src/PVE/LXC/Config.pm | 7 +++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 62b6b8c..3f4c533 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1415,11 +1415,19 @@ sub mountpoint_mount {
die "unknown snapshot path for '$volid'" if !$storage && defined($snapname);
- my $optstring = '';
+ my @mountoptions= split(/;/, $mountpoint->{mountoptions});
+ my $optlist = [];
+ foreach my $opt (@mountoptions) {
+ push @$optlist, $opt;
+ }
+
my $acl = $mountpoint->{acl};
if (defined($acl)) {
- $optstring .= ($acl ? 'acl' : 'noacl');
+ push @$optlist, ($acl ? 'acl' : 'noacl');
}
+
+ my $optstring = '';
+ $optstring = join(',', @$optlist);
my $readonly = $mountpoint->{ro};
my @extra_opts;
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 8dcd73c..99efb54 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -236,6 +236,13 @@ my $rootfs_desc = {
description => 'Explicitly enable or disable ACL support.',
optional => 1,
},
+ mountoptions => {
+ optional => 1,
+ type => 'string',
+ description => 'Extra mount options for rootfs/mps.',
+ format_description => 'opt;opt;...',
+ pattern => qr/[a-zA-Z0-9; ]+/,
+ },
ro => {
type => 'boolean',
description => 'Read-only mount point',
--
2.11.0
More information about the pve-devel
mailing list