[pve-devel] [PATCH container 3/3] use snapshot_tree guest helper for pct listsnapshot

Oguz Bektas o.bektas at proxmox.com
Tue Oct 1 09:33:08 CEST 2019


adds feature parity between qm/pct 'listsnapshot' w.r.t. showing
snapshot tree ordered by date.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/CLI/pct.pm | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 35ad72f..0dd694b 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -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::snapshot_tree ],
 
     rollback => [ "PVE::API2::LXC::Snapshot", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
 
-- 
2.20.1




More information about the pve-devel mailing list