[pve-devel] applied: [PATCH manager] adapt osd api call for ceph nautilus
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Apr 24 13:42:04 CEST 2019
Am 4/19/19 um 4:02 PM schrieb Dominik Csapak:
> 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
>
applied, with a bit of follow ups in this and calling area.
Thanks!
> 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) {
>
More information about the pve-devel
mailing list