[pve-devel] [PATCH v3 container] include custom lxc options when displaying config

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jul 5 11:34:44 CEST 2016


applied

On Tue, Jul 05, 2016 at 10:30:10AM +0200, Fabian Grünbichler wrote:
> this makes the "pct config" output more complete, the object
> returned by the API path contains the lxc options as parsed
> by our config parser, e.g.:
> 
>    "lxc" : [
>       [
>          "lxc.cap.keep",
>          "sys_time"
>       ],
>       [
>          "lxc.cap.drop",
>          "abc"
>       ],
>       [
>          "lxc.cap.drop",
>          ""
>       ]
>    ],
> ---
> Changes to v2:
> - use $foo->[i] instead of @$foo[i]
> 
>  src/PVE/API2/LXC/Config.pm | 1 -
>  src/PVE/CLI/pct.pm         | 7 +++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm
> index 0d0732e..8597192 100644
> --- a/src/PVE/API2/LXC/Config.pm
> +++ b/src/PVE/API2/LXC/Config.pm
> @@ -51,7 +51,6 @@ __PACKAGE__->register_method({
>  	my $conf = PVE::LXC::Config->load_config($param->{vmid});
>  
>  	delete $conf->{snapshots};
> -	delete $conf->{lxc};
>  
>  	return $conf;
>      }});
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index b660585..3e99313 100755
> --- a/src/PVE/CLI/pct.pm
> +++ b/src/PVE/CLI/pct.pm
> @@ -625,12 +625,19 @@ our $cmddef = {
>  		    my $config = shift;
>  		    foreach my $k (sort (keys %$config)) {
>  			next if $k eq 'digest';
> +			next if $k eq 'lxc';
>  			my $v = $config->{$k};
>  			if ($k eq 'description') {
>  			    $v = PVE::Tools::encode_text($v);
>  			}
>  			print "$k: $v\n";
>  		    }
> +		    if (defined($config->{'lxc'})) {
> +			my $lxc_list = $config->{'lxc'};
> +			foreach my $lxc_opt (@$lxc_list) {
> +			    print "$lxc_opt->[0]: $lxc_opt->[1]\n"
> +			}
> +		    }
>  		}],
>      set => [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node => $nodename }],
>  
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list