[pve-devel] [pve-storage cli cleanup 1/5] pvesm status: use print_api_result
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 9 11:43:37 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/CLI/pvesm.pm | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index d95b5f5..c82bb6f 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -11,6 +11,8 @@ use PVE::SafeSyslog;
use PVE::Cluster;
use PVE::INotify;
use PVE::RPCEnvironment;
+use PVE::RESTHandler;
+use PVE::CLIFormatter;
use PVE::Storage;
use PVE::API2::Storage::Config;
use PVE::API2::Storage::Content;
@@ -189,7 +191,7 @@ __PACKAGE__->register_method ({
type => 'string',
completion => \&PVE::Storage::complete_volume,
},
- format => {
+ 'format' => {
description => "Export stream format",
type => 'string',
enum => $KNOWN_EXPORT_FORMATS,
@@ -264,7 +266,7 @@ __PACKAGE__->register_method ({
type => 'string',
completion => \&PVE::Storage::complete_volume,
},
- format => {
+ 'format' => {
description => "Import stream format",
type => 'string',
enum => $KNOWN_EXPORT_FORMATS,
@@ -325,8 +327,11 @@ our $cmddef = {
add => [ "PVE::API2::Storage::Config", 'create', ['type', 'storage'] ],
set => [ "PVE::API2::Storage::Config", 'update', ['storage'] ],
remove => [ "PVE::API2::Storage::Config", 'delete', ['storage'] ],
- status => [ "PVE::API2::Storage::Status", 'index', [],
- { node => $nodename }, $print_status ],
+ status => [ "PVE::API2::Storage::Status", 'index', [], { node => $nodename }, sub {
+ my ($data, $schema, $options) = @_;
+ my $props = ['storage', 'type', 'enabled', 'active', 'shared', 'total', 'used', 'used_fraction'];
+ PVE::CLIFormatter::print_api_result($data, $schema, $props, $options);
+ }, $PVE::RESTHandler::standard_output_options],
list => [ "PVE::API2::Storage::Content", 'index', ['storage'],
{ node => $nodename }, $print_content ],
alloc => [ "PVE::API2::Storage::Content", 'create', ['storage', 'vmid', 'filename', 'size'],
--
2.11.0
More information about the pve-devel
mailing list