Use vitastor-cli df to show pool stats in Proxmox

test-assert
Vitaliy Filippov 2021-12-10 02:42:31 +03:00
parent 0ee5e0a7fe
commit b82c30328f
1 changed files with 5 additions and 5 deletions

View File

@ -339,11 +339,11 @@ sub list_images
sub status sub status
{ {
my ($class, $storeid, $scfg, $cache) = @_; my ($class, $storeid, $scfg, $cache) = @_;
# FIXME: take it from etcd my $stats = [ grep { $_->{name} eq $scfg->{vitastor_pool} } @{ run_cli($scfg, [ 'df' ]) } ]->[0];
my $free = 0; my $free = $stats ? $stats->{max_available} : 0;
my $used = 0; my $used = $stats ? $stats->{used_raw}/($stats->{raw_to_usable}||1) : 0;
my $total = $used + $free; my $total = $free+$used;
my $active = 1; my $active = $stats ? 1 : 0;
return ($total, $free, $used, $active); return ($total, $free, $used, $active);
} }