[pve-devel] [PATCH container 6/9] add 'pct pending' command
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Sep 11 09:39:45 CEST 2019
On September 5, 2019 4:11 pm, Oguz Bektas wrote:
> analog to 'qm pending', it shows a list of keys and values defined in
> configuration.
copied verbatim from qm.pm, maybe we could move this code to
GuestHelpers.pm (format_pending)?
>
> 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
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list