ceph osd find 0
ceph osd add-nodown 0 1
- ceph health detail | grep 'nodown osd(s).*0.*1'
+ ceph health detail | grep 'NODOWN'
ceph osd rm-nodown 0 1
- ! ceph health detail | grep 'nodown osd(s).*0.*1'
+ ! ceph health detail | grep 'NODOWN'
ceph osd out 0 # so we can mark it as noin later
ceph osd add-noin 0
- ceph health detail | grep 'noin osd(s).*0'
+ ceph health detail | grep 'NOIN'
ceph osd rm-noin 0
- ! ceph health detail | grep 'noin osd(s).*0'
+ ! ceph health detail | grep 'NOIN'
ceph osd in 0
ceph osd add-noout 0
- ceph health detail | grep 'noout osd(s).*0'
+ ceph health detail | grep 'NOOUT'
ceph osd rm-noout 0
- ! ceph health detail | grep 'noout osds(s).*0'
+ ! ceph health detail | grep 'NOOUT'
# test osd id parse
expect_false ceph osd add-noup 797er
ceph osd add-nodown $osd
ceph osd add-noout $osd
done
- ceph -s | grep 'nodown osd(s)'
- ceph -s | grep 'noout osd(s)'
+ ceph -s | grep 'NODOWN'
+ ceph -s | grep 'NOOUT'
ceph osd rm-nodown any
ceph osd rm-noout all
- ! ceph -s | grep 'nodown osd(s)'
- ! ceph -s | grep 'noout osd(s)'
+ ! ceph -s | grep 'NODOWN'
+ ! ceph -s | grep 'NOOUT'
# make sure mark out preserves weight
ceph osd reweight osd.0 .5
}
}
- // OSD_FLAGS
+ // OSDMAP_FLAGS
{
// warn about flags
uint64_t warn_flags =
ostringstream ss;
ss << get_flag_string(get_flags() & warn_flags)
<< " flag(s) set";
- checks->add("OSD_FLAGS", HEALTH_WARN, ss.str());
+ checks->add("OSDMAP_FLAGS", HEALTH_WARN, ss.str());
+ }
+ }
+
+ // OSD_FLAGS
+ {
+ list<string> detail;
+ const unsigned flags =
+ CEPH_OSD_NOUP |
+ CEPH_OSD_NOIN |
+ CEPH_OSD_NODOWN |
+ CEPH_OSD_NOOUT;
+ for (int i = 0; i < max_osd; ++i) {
+ if (osd_state[i] & flags) {
+ ostringstream ss;
+ set<string> states;
+ OSDMap::calc_state_set(osd_state[i] & flags, states);
+ ss << "osd." << i << " has flags " << states;
+ detail.push_back(ss.str());
+ }
+ }
+ if (!detail.empty()) {
+ ostringstream ss;
+ ss << detail.size() << " osd(s) have {NOUP,NODOWN,NOIN,NOOUT} flags set";
+ auto& d = checks->add("OSD_FLAGS", HEALTH_WARN, ss.str());
+ d.detail.swap(detail);
}
}