From 8b131088175e0bc5a0202e51810f3f30e31607c4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 Apr 2019 11:10:35 -0500 Subject: [PATCH] osd/OSDMap: raise OSD_FLAGS health alert for crush node flags, too Signed-off-by: Sage Weil (cherry picked from commit 9aa9893b8f67614f40c3de3ed8dacd1105eec5f4) --- doc/rados/operations/health-checks.rst | 19 ++++++++++--------- src/osd/OSDMap.cc | 14 +++++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/doc/rados/operations/health-checks.rst b/doc/rados/operations/health-checks.rst index 09b748eabe32c..15b8f909e3c40 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 d73930b66ac7f..c2438d17c7503 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); } -- 2.39.5