[pve-devel] [PATCH manager 1/2] Fix: #1542, use percent_used key instead of calculation

Alwin Antreich a.antreich at proxmox.com
Mon Oct 30 17:48:52 CET 2017


Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/API2/Ceph.pm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 54bad234..efea3059 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1493,7 +1493,6 @@ __PACKAGE__->register_method ({

 	my $stats = {};
 	my $res = $rados->mon_command({ prefix => 'df' });
-	my $total = $res->{stats}->{total_avail_bytes} || 0;

 	foreach my $d (@{$res->{pools}}) {
 	    next if !$d->{stats};
@@ -1522,8 +1521,7 @@ __PACKAGE__->register_method ({

 	    if (my $s = $stats->{$d->{pool}}) {
 		$d->{bytes_used} = $s->{bytes_used};
-		$d->{percent_used} = ($s->{bytes_used} / $total)*100
-		    if $s->{max_avail} && $total;
+		$d->{percent_used} = $s->{percent_used};
 	    }
 	    push @$data, $d;
 	}
--
2.11.0




More information about the pve-devel mailing list