]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: raise OSD_FLAGS health alert for crush node flags, too
authorSage Weil <sage@redhat.com>
Fri, 12 Apr 2019 16:10:35 +0000 (11:10 -0500)
committerSage Weil <sage@redhat.com>
Tue, 16 Apr 2019 22:22:47 +0000 (17:22 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 9aa9893b8f67614f40c3de3ed8dacd1105eec5f4)

doc/rados/operations/health-checks.rst
src/osd/OSDMap.cc

index 09b748eabe32c60bedc697f607b22a21517e6a84..15b8f909e3c4015ae1d00b9b500f692d44be3e7b 100644 (file)
@@ -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-<flag> <osd-id>
-  ceph osd rm-<flag> <osd-id>
+  ceph osd add-<flag> <osd-id-or-crush-node-name>
+  ceph osd rm-<flag> <osd-id-or-crush-node-name>
 
 For example, ::
 
   ceph osd rm-nodown osd.123
+  ceph osd rm-noout hostfoo
 
 OLD_CRUSH_TUNABLES
 __________________
index d73930b66ac7fe42e0a8fbf5af11a04321fee4cb..c2438d17c7503bcce9006dbfc50bcd9a262872bc 100644 (file)
@@ -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<string> 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);
     }