]> git.proxmox.com Git - qemu-server.git/commitdiff
cli: use guesthelper for pending
authorOguz Bektas <o.bektas@proxmox.com>
Mon, 14 Oct 2019 08:28:39 +0000 (10:28 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 16:45:27 +0000 (18:45 +0200)
use the shared format_pending method from guesthelpers

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
PVE/CLI/qm.pm

index bc9e227a0b208afa4afacae7642b0b30fac3c750..ea74ad5ac4c5890072b1a5b64d26b3e9489ec6a9 100755 (executable)
@@ -898,33 +898,7 @@ our $cmddef = {
                    }
                }],
 
-    pending => [ "PVE::API2::Qemu", '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";
-                       }
-                   }
-               }],
-
+    pending => [ "PVE::API2::Qemu", 'vm_pending', ['vmid'], { node => $nodename }, \&PVE::GuestHelpers::format_pending ],
     showcmd => [ __PACKAGE__, 'showcmd', ['vmid']],
 
     status => [ __PACKAGE__, 'status', ['vmid']],