[pve-devel] [PATCH container v3] close #1478: add check for unsupported config

Dietmar Maurer dietmar at proxmox.com
Wed Aug 23 16:51:47 CEST 2017


I wonder if this simplified version works:

	    if ($conf->{unprivileged}) {
		PVE::LXC::Config->foreach_mountpoint($conf, sub {
		    my ($ms, $mountpoint) = @_;
		    die "Quotas are not supported by unprivileged containers.\n" if
$mountpoint->{quota};
		});
	    }

> On August 23, 2017 at 4:27 PM Philip Abernethy <p.abernethy at proxmox.com>
> wrote:
> 
> 
> Adds a check if an unprivileged container is configured to use
> quota on any of its mountpoints. If so an understandable error
> message is given. Ideally I'd like to catch those
> configurations on the GUI, too, to avoid users just running
> into it.
> ---
> Done. GUI fix coming up.
>  src/PVE/API2/LXC/Status.pm | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
> index 89a2fca..5959bc3 100644
> --- a/src/PVE/API2/LXC/Status.pm
> +++ b/src/PVE/API2/LXC/Status.pm
> @@ -177,6 +177,16 @@ __PACKAGE__->register_method({
>  			PVE::LXC::Config->check_lock($conf);
>  		    }
>  
> +		    if ($conf->{unprivileged}) {
> +			my $uses_quota = 0;
> +			PVE::LXC::Config->foreach_mountpoint($conf, sub {
> +			    my ($ms, $mountpoint) = @_;
> +			    $uses_quota = $uses_quota || $mountpoint->{quota};
> +			});
> +
> +			die "Quotas are not supported by unprivileged containers.\n" if
> ($uses_quota);
> +		    }
> +




More information about the pve-devel mailing list