to present more data on pools and a nicer formated output on the command line.
Signed-off-by: Alwin Antreich <a.antre...@proxmox.com> --- PVE/API2/Ceph.pm | 14 ++++++++++---- PVE/CLI/pveceph.pm | 24 ++++++++++++++---------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index d872c7c0..d7e5892c 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -604,10 +604,16 @@ __PACKAGE__->register_method ({ items => { type => "object", properties => { - pool => { type => 'integer' }, - pool_name => { type => 'string' }, - size => { type => 'integer' }, - pg_autoscale_mode => { type => 'string', optional => 1 }, + pool => { type => 'integer', title => 'ID' }, + pool_name => { type => 'string', title => 'Name' }, + size => { type => 'integer', title => 'Size' }, + min_size => { type => 'integer', title => 'Min Size' }, + pg_num => { type => 'integer', title => 'PG Num' }, + pg_autoscale_mode => { type => 'string', optional => 1, title => 'PG Autoscale Mode' }, + crush_rule => { type => 'integer', title => 'Crush Rule' }, + crush_rule_name => { type => 'string', title => 'Crush Rule Name' }, + percent_used => { type => 'number', title => '%-Used' }, + bytes_used => { type => 'integer', title => 'Used' }, }, }, links => [ { rel => 'child', href => "{pool_name}" } ], diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm index 92500253..b4c8b79c 100755 --- a/PVE/CLI/pveceph.pm +++ b/PVE/CLI/pveceph.pm @@ -182,16 +182,20 @@ our $cmddef = { init => [ 'PVE::API2::Ceph', 'init', [], { node => $nodename } ], pool => { ls => [ 'PVE::API2::Ceph', 'lspools', [], { node => $nodename }, sub { - my $res = shift; - - printf("%-20s %10s %10s %10s %10s %20s\n", "Name", "size", "min_size", - "pg_num", "%-used", "used"); - foreach my $p (sort {$a->{pool_name} cmp $b->{pool_name}} @$res) { - printf("%-20s %10d %10d %10d %10.2f %20d\n", $p->{pool_name}, - $p->{size}, $p->{min_size}, $p->{pg_num}, - $p->{percent_used}, $p->{bytes_used}); - } - }], + my ($data, $schema, $options) = @_; + PVE::CLIFormatter::print_api_result($data, $schema, + [ + 'pool_name', + 'size', + 'min_size', + 'pg_num', + 'pg_autoscale_mode', + 'crush_rule_name', + 'percent_used', + 'bytes_used', + ], + $options); + }, $PVE::RESTHandler::standard_output_options], create => [ 'PVE::API2::Ceph', 'createpool', ['name'], { node => $nodename }], destroy => [ 'PVE::API2::Ceph', 'destroypool', ['name'], { node => $nodename } ], }, -- 2.26.2 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel