[pve-devel] [PATCH container 6/9] add 'pct pending' command
Oguz Bektas
o.bektas at proxmox.com
Thu Sep 5 16:11:18 CEST 2019
analog to 'qm pending', it shows a list of keys and values defined in
configuration.
cur: current change
new: pending change
del: pending delete
Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
src/PVE/CLI/pct.pm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 35ad72f..78cb406 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -821,6 +821,33 @@ our $cmddef = {
}
}
}],
+
+ pending => [ "PVE::API2::LXC", "vm_pending", ['vmid'],
+ { node => $nodename }, sub {
+ my $data = shift;
+ foreach my $item (sort { $a->{key} cmp $b->{key}} @$data) {
+ my $k = $item->{key};
+ next if $k eq 'digest';
+ my $v = $item->{value};
+ my $p = $item->{pending};
+ if ($k eq 'description') {
+ $v = PVE::Tools::encode_text($v) if defined($v);
+ $p = PVE::Tools::encode_text($p) if defined($p);
+ }
+ if (defined($v)) {
+ if ($item->{delete}) {
+ print "del $k: $v\n";
+ } elsif (defined($p)) {
+ print "cur $k: $v\n";
+ print "new $k: $p\n";
+ } else {
+ print "cur $k: $v\n";
+ }
+ } elsif (defined($p)) {
+ print "new $k: $p\n";
+ }
+ }
+ }],
set => [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node => $nodename }],
resize => [ "PVE::API2::LXC", 'resize_vm', ['vmid', 'disk', 'size'], { node => $nodename } ],
--
2.20.1
More information about the pve-devel
mailing list