[pve-devel] [PATCH RFC container] include custom lxc options when displaying config
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jun 15 11:44:05 CEST 2016
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",
""
]
],
---
Note: as far as I can tell, this should not affect the
GUI at all, since the LXC config keys are always matched
with whatever is displayed in the current view.
src/PVE/API2/LXC/Config.pm | 1 -
src/PVE/CLI/pct.pm | 10 ++++++++++
2 files changed, 10 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 ca87229..748ace3 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -542,12 +542,22 @@ 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) {
+ if (@$lxc_opt == 2) {
+ my $v = PVE::Tools::encode_text(@$lxc_opt[1]);
+ print "@$lxc_opt[0]: $v\n"
+ }
+ }
+ }
}],
set => [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node => $nodename }],
--
2.1.4
More information about the pve-devel
mailing list