Signed-off-by: Alwin Antreich <a.antre...@proxmox.com>
---
 PVE/API2/Ceph.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index efea3059..a0260fe2 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1522,6 +1522,18 @@ __PACKAGE__->register_method ({
            if (my $s = $stats->{$d->{pool}}) {
                $d->{bytes_used} = $s->{bytes_used};
                $d->{percent_used} = $s->{percent_used};
+
+               if (!defined($d->{percent_used})) {
+                   my $o = $rados->mon_command({ prefix => 'pg dump' });
+                   foreach my $p (@{$o->{pool_stats}}) {
+                       if ($p->{poolid} == $d->{pool}) {
+                           my $stat = $p->{stat_sum};
+                           my $used = $stat->{num_bytes} * 
(($stat->{num_object_copies} - $stat->{num_objects_degraded}) / 
$stat->{num_object_copies});
+                           $used /= ($used + $s->{max_avail});
+                       $d->{percent_used} = $used * 100;
+                       }
+                   }
+               }
            }
            push @$data, $d;
        }
--
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to