From: Sage Weil Date: Fri, 12 Apr 2019 16:10:35 +0000 (-0500) Subject: osd/OSDMap: raise OSD_FLAGS health alert for crush node flags, too X-Git-Tag: v14.2.2~213^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b131088175e0bc5a0202e51810f3f30e31607c4;p=ceph.git osd/OSDMap: raise OSD_FLAGS health alert for crush node flags, too Signed-off-by: Sage Weil (cherry picked from commit 9aa9893b8f67614f40c3de3ed8dacd1105eec5f4) --- diff --git a/doc/rados/operations/health-checks.rst b/doc/rados/operations/health-checks.rst index 09b748eabe32..15b8f909e3c4 100644 --- a/doc/rados/operations/health-checks.rst +++ b/doc/rados/operations/health-checks.rst @@ -223,23 +223,24 @@ With the exception of *full*, these flags can be set or cleared with:: OSD_FLAGS _________ -One or more OSDs has a per-OSD flag of interest set. These flags include: +One or more OSDs or CRUSH nodes has a flag of interest set. These flags include: -* *noup*: OSD is not allowed to start -* *nodown*: failure reports for this OSD will be ignored -* *noin*: if this OSD was previously marked `out` automatically - after a failure, it will not be marked in when it stats -* *noout*: if this OSD is down it will not automatically be marked +* *noup*: these OSDs are not allowed to start +* *nodown*: failure reports for these OSDs will be ignored +* *noin*: if these OSDs were previously marked `out` automatically + after a failure, they will not be marked in when they start +* *noout*: if these OSDs are down they will not automatically be marked `out` after the configured interval -Per-OSD flags can be set and cleared with:: +These flags can be set and cleared with:: - ceph osd add- - ceph osd rm- + ceph osd add- + ceph osd rm- For example, :: ceph osd rm-nodown osd.123 + ceph osd rm-noout hostfoo OLD_CRUSH_TUNABLES __________________ diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index d73930b66ac7..c2438d17c750 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -5612,9 +5612,21 @@ void OSDMap::check_health(health_check_map_t *checks) const detail.push_back(ss.str()); } } + for (auto& i : crush_node_flags) { + if (i.second && crush->item_exists(i.first)) { + ostringstream ss; + set states; + OSDMap::calc_state_set(i.second, states); + int t = i.first >= 0 ? 0 : crush->get_bucket_type(i.first); + const char *tn = crush->get_type_name(t); + ss << (tn ? tn : "node") << " " + << crush->get_item_name(i.first) << " 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"; + ss << detail.size() << " OSDs or CRUSH nodes have {NOUP,NODOWN,NOIN,NOOUT} flags set"; auto& d = checks->add("OSD_FLAGS", HEALTH_WARN, ss.str()); d.detail.swap(detail); }