[pve-devel] [qemu-server cli cleanup 5/6] qm listsnapshot: use print_api_result
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 9 11:43:53 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/CLI/qm.pm | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 0116f21..043370c 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -791,15 +791,11 @@ our $cmddef = {
delsnapshot => [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
listsnapshot => [ "PVE::API2::Qemu", '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);
- }
- }],
+ sub {
+ my ($data, $schema, $options) = @_;
+ my $proplist = ['name', 'snaptime', 'vmstate', 'parent', 'description'];
+ PVE::CLIFormatter::print_api_result($data, $schema, $proplist, $options);
+ }, $PVE::RESTHandler::standard_output_options],
rollback => [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
--
2.11.0
More information about the pve-devel
mailing list