summary.push_back(make_pair(HEALTH_ERR, ss.str()));
}
- map<int, float> full, backfillfull, nearfull;
- osdmap.get_full_osd_util(mon->pgservice->get_osd_stat(), &full, &backfillfull, &nearfull);
+ set<int> full, backfillfull, nearfull;
+ osdmap.get_full_osd_counts(&full, &backfillfull, &nearfull);
if (full.size()) {
ostringstream ss;
ss << full.size() << " full osd(s)";
if (detail) {
for (auto& i: full) {
ostringstream ss;
- ss << "osd." << i.first << " is full at " << roundf(i.second * 100) << "%";
+ ss << "osd." << i << " is full";
detail->push_back(make_pair(HEALTH_ERR, ss.str()));
}
for (auto& i: backfillfull) {
ostringstream ss;
- ss << "osd." << i.first << " is backfill full at " << roundf(i.second * 100) << "%";
+ ss << "osd." << i << " is backfill full";
detail->push_back(make_pair(HEALTH_WARN, ss.str()));
}
for (auto& i: nearfull) {
ostringstream ss;
- ss << "osd." << i.first << " is near full at " << roundf(i.second * 100) << "%";
+ ss << "osd." << i << " is near full";
detail->push_back(make_pair(HEALTH_WARN, ss.str()));
}
}
}
}
+void OSDMap::get_full_osd_counts(set<int> *full, set<int> *backfill,
+ set<int> *nearfull) const
+{
+ full->clear();
+ backfill->clear();
+ nearfull->clear();
+ for (int i = 0; i < max_osd; ++i) {
+ if (exists(i) && is_up(i) && is_in(i)) {
+ if (osd_state[i] & CEPH_OSD_FULL)
+ full->emplace(i);
+ else if (osd_state[i] & CEPH_OSD_BACKFILLFULL)
+ backfill->emplace(i);
+ else if (osd_state[i] & CEPH_OSD_NEARFULL)
+ nearfull->emplace(i);
+ }
+ }
+}
+
void OSDMap::get_all_osds(set<int32_t>& ls) const
{
for (int i=0; i<max_osd; i++)
map<int, float> *backfill,
map<int, float> *nearfull) const;
+ void get_full_osd_counts(set<int> *full, set<int> *backfill,
+ set<int> *nearfull) const;
+
+
/***** cluster state *****/
/* osds */
int get_max_osd() const { return max_osd; }