Luminous, Nautilus and Octopus. In Octopus the mon_status was dropped.
Also the ceph status was cleaned up and doesn't provide the mgrmap and
monmap.
The rados queries used in the ceph status API endpoints (cluster / node)
were factored out and merged to one place.
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
PVE::Ceph::Tools::check_ceph_inited();
- my $rados = PVE::RADOS->new();
- my $status = $rados->mon_command({ prefix => 'status' });
- $status->{health} = $rados->mon_command({ prefix => 'health', detail => 'detail' });
- return $status;
+ return PVE::Ceph::Tools::ceph_cluster_status();
}});
__PACKAGE__->register_method ({
my $monhash = PVE::Ceph::Services::get_services_info("mon", $cfg, $rados);
if ($rados) {
- my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+ my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
my $mons = $monstat->{monmap}->{mons};
foreach my $d (@$mons) {
my $monsection = "mon.$monid";
my $rados = PVE::RADOS->new();
- my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+ my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
my $monlist = $monstat->{monmap}->{mons};
my $monhash = PVE::Ceph::Services::get_services_info('mon', $cfg, $rados);
# reopen with longer timeout
$rados = PVE::RADOS->new(timeout => PVE::Ceph::Tools::get_config('long_rados_timeout'));
$monhash = PVE::Ceph::Services::get_services_info('mon', $cfg, $rados);
- $monstat = $rados->mon_command({ prefix => 'mon_status' });
+ $monstat = $rados->mon_command({ prefix => 'quorum_status' });
$monlist = $monstat->{monmap}->{mons};
my $addr;
# get necessary ceph infos
my $rados = PVE::RADOS->new();
- my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+ my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
die "unable to get fsid\n" if !$monstat->{monmap} || !$monstat->{monmap}->{fsid};
my $fsid = $monstat->{monmap}->{fsid};
PVE::Ceph::Tools::check_ceph_inited();
- my $rados = PVE::RADOS->new();
- my $status = $rados->mon_command({ prefix => 'status' });
- $status->{health} = $rados->mon_command({ prefix => 'health', detail => 'detail' });
- return $status;
+ return PVE::Ceph::Tools::ceph_cluster_status();
}
});
return $flagmap->{$flag} // $flag;
}
+sub ceph_cluster_status {
+ my ($rados) = @_;
+ $rados = PVE::RADOS->new() if !$rados;
+
+ my $ceph_version = get_local_version(1);
+ my $status = $rados->mon_command({ prefix => 'status' });
+
+ $status->{health} = $rados->mon_command({ prefix => 'health', detail => 'detail' });
+
+ if (!$ceph_version < 15) {
+ $status->{monmap} = $rados->mon_command({ prefix => 'mon dump' });
+ $status->{mgrmap} = $rados->mon_command({ prefix => 'mgr dump' });
+ }
+
+ return $status;
+}
+
1;
var pgmap = status.pgmap || {};
var health = status.health || {};
- var osdmap = status.osdmap || { osdmap: {} };
+ var osdmap = status.osdmap || {};
+ if (typeof osdmap.osdmap != "undefined") {
+ osdmap = osdmap.osdmap;
+ }
// update pgs sorted
var pgs_by_state = pgmap.pgs_by_state || [];
// update osds counts
- var total_osds = osdmap.osdmap.num_osds || 0;
- var in_osds = osdmap.osdmap.num_in_osds || 0;
- var up_osds = osdmap.osdmap.num_up_osds || 0;
+ // pre-octopus || octopus || 0
+ var total_osds = osdmap.num_osds || 0;
+ var in_osds = osdmap.num_in_osds || 0;
+ var up_osds = osdmap.num_up_osds || 0;
var out_osds = total_osds - in_osds;
var down_osds = total_osds - up_osds;