]> git.proxmox.com Git - pve-container.git/commitdiff
implement pct listsnapshot cli command
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 20 Aug 2015 14:55:36 +0000 (16:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 20 Aug 2015 14:56:35 +0000 (16:56 +0200)
src/PVE/API2/LXC/Snapshot.pm
src/pct

index 7ed6614fc63b437081ff986853414b1ec2e95da6..3938d7d259fd8ceab184e854d87def715e5459a5 100644 (file)
@@ -20,7 +20,7 @@ use PVE::JSONSchema qw(get_standard_option);
 use base qw(PVE::RESTHandler);
 
 __PACKAGE__->register_method({
-    name => 'snapshot_list',
+    name => 'list',
     path => '',
     method => 'GET',
     description => "List all snapshots.",
diff --git a/src/pct b/src/pct
index 0cacb3e06e003a71ccbe0cb0d18bc33a55778549..6821ea326a6e65a2e3076cc12896a9588cb8f22e 100755 (executable)
--- a/src/pct
+++ b/src/pct
@@ -133,6 +133,17 @@ my $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);
+                         }
+                     }],
+
     rollback => [ "PVE::API2::LXC::Snapshot", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
 
     template => [ "PVE::API2::LXC", 'template', ['vmid'], { node => $nodename }],