]> git.proxmox.com Git - pve-container.git/commitdiff
use print_snapshot_tree guest helper for pct listsnapshot
authorOguz Bektas <o.bektas@proxmox.com>
Wed, 2 Oct 2019 09:39:54 +0000 (11:39 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 09:31:01 +0000 (11:31 +0200)
adds feature parity between qm/pct 'listsnapshot' w.r.t. showing
snapshot tree ordered by date.

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

index 35ad72fbb21737d61f70b40cfa159f88a86236c2..705a015dbc142c4c0185acf817803b7e0352c8e7 100755 (executable)
@@ -861,16 +861,7 @@ our $cmddef = {
 
     delsnapshot => [ "PVE::API2::LXC::Snapshot", 'delsnapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
 
-    listsnapshot => [ "PVE::API2::LXC::Snapshot", 'list', ['vmid'], { node => $nodename },
-                     sub {
-                         my $res = shift;
-                         foreach my $e (@$res) {
-                             my $headline = $e->{description} || 'no-description';
-                             $headline =~ s/\n.*//sg;
-                             my $parent = $e->{parent} // 'no-parent';
-                             printf("%-20s %-20s %s\n", $e->{name}, $parent, $headline);
-                         }
-                     }],
+    listsnapshot => [ "PVE::API2::LXC::Snapshot", 'list', ['vmid'], { node => $nodename }, \&PVE::GuestHelpers::print_snapshot_tree ],
 
     rollback => [ "PVE::API2::LXC::Snapshot", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],