[pve-devel] [PATCH manager] adapt osd api call for ceph nautilus
Dominik Csapak
d.csapak at proxmox.com
Fri Apr 19 16:02:05 CEST 2019
ceph nautilus changed the structure of 'pg dump osds'
they moved the data one level below
parse both new and old format, and bail if it returns anything else
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/API2/Ceph/OSD.pm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index 4b386ebe..9f1e6779 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -45,7 +45,16 @@ my $get_osd_status = sub {
my $get_osd_usage = sub {
my ($rados) = @_;
- my $osdlist = $rados->mon_command({ prefix => 'pg dump', dumpcontents => [ 'osds' ]}) || [];
+ my $res = $rados->mon_command({ prefix => 'pg dump', dumpcontents => [ 'osds' ]}) || [];
+ my $osdlist;
+
+ if (ref($res) eq "HASH") { # since nautilus
+ $osdlist = $res->{osd_stats};
+ } elsif (ref($res) eq "ARRAY") { # until luminous
+ $osdlist = $res;
+ } else { # bail
+ die "unknown format of pg dump osds\n";
+ }
my $osdstat;
foreach my $d (@$osdlist) {
--
2.11.0
More information about the pve-devel
mailing list