Skip to content

Commit

Permalink
Merge pull request #12273 from songbaisen/s4
Browse files Browse the repository at this point in the history
mon: add warn info for osds were removed from osdmap but still kept in crushmap

Reviewed-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
yuriw committed Feb 7, 2017
2 parents 1a8e353 + 1b8d33d commit 9f937aa
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2880,9 +2880,16 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
} else {
int num_in_osds = 0;
int num_down_in_osds = 0;
set<int> osds;
for (int i = 0; i < osdmap.get_max_osd(); i++) {
if (!osdmap.exists(i) || osdmap.is_out(i))
continue;
if (!osdmap.exists(i)) {
if (osdmap.crush->item_exists(i)) {
osds.insert(i);
}
continue;
}
if (osdmap.is_out(i))
continue;
++num_in_osds;
if (!osdmap.is_up(i)) {
++num_down_in_osds;
Expand All @@ -2902,6 +2909,15 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
summary.push_back(make_pair(HEALTH_WARN, ss.str()));
}

if (!osds.empty()) {
ostringstream ss;
ss << "osds were removed from osdmap, but still kept in crushmap";
summary.push_back(make_pair(HEALTH_WARN, ss.str()));
if (detail) {
ss << " osds: [" << osds << "]";
detail->push_back(make_pair(HEALTH_WARN, ss.str()));
}
}
// warn about flags
uint64_t warn_flags =
CEPH_OSDMAP_FULL |
Expand Down

0 comments on commit 9f937aa

Please sign in to comment.