[pve-devel] [PATCH v2 container 1/2] fix #1451: add mountoptions to container config

Oguz Bektas o.bektas at proxmox.com
Tue May 21 11:24:50 CEST 2019


hi!

On Tue, May 21, 2019 at 11:15:27AM +0200, Thomas Lamprecht wrote:
> On 5/21/19 10:47 AM, Oguz Bektas wrote:
> > 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);
> 
> can be:
> my $optstring = join(',', @$optlist);
thanks
> 
> 
> >      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.',
> 
> "Extra mount options applied on this mount point"
> 
> Maybe add a verbose desc. that this does not gets checked against any 
> conflicts, etc. from inside this, or with the ones set by us..
alright
> 
> > +	format_description => 'opt;opt;...',
> > +	pattern => qr/[a-zA-Z0-9; ]+/,
> 
> and we're sure about allowing all?? also there's no option
during offline discussion we decided to allow everything in the
config.
> on any FS supported option which can include ';' ? 
not that i could see. there's some options with _ though, so might add
that too.
> 
> > +    },
> >      ro => {
> >  	type => 'boolean',
> >  	description => 'Read-only mount point',
> > 
> 




More information about the pve-devel mailing list