From: Sage Weil Date: Fri, 12 Apr 2019 16:50:22 +0000 (-0500) Subject: mon/OSDMonitor: respect crush node flags for can_mark_*() X-Git-Tag: v15.1.0~2919^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=79f0043208f9ba2d4cf02877e6f349b8d0ce55dc;p=ceph-ci.git mon/OSDMonitor: respect crush node flags for can_mark_*() Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ef807bf3754..c31f480260b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2454,6 +2454,13 @@ bool OSDMonitor::can_mark_down(int i) return false; } + if (osdmap.get_crush_node_flags(i) & CEPH_OSD_NODOWN) { + dout(5) << __func__ << " osd." << i + << " is marked as nodown via a crush node flag, " + << "will not mark it down" << dendl; + return false; + } + int num_osds = osdmap.get_num_osds(); if (num_osds == 0) { dout(5) << __func__ << " no osds" << dendl; @@ -2484,6 +2491,13 @@ bool OSDMonitor::can_mark_up(int i) return false; } + if (osdmap.get_crush_node_flags(i) & CEPH_OSD_NOUP) { + dout(5) << __func__ << " osd." << i + << " is marked as noup via a crush node flag, " + << "will not mark it up" << dendl; + return false; + } + return true; } @@ -2504,6 +2518,13 @@ bool OSDMonitor::can_mark_out(int i) return false; } + if (osdmap.get_crush_node_flags(i) & CEPH_OSD_NOOUT) { + dout(5) << __func__ << " osd." << i + << " is marked as noout via a crush node flag, " + << "will not mark it out" << dendl; + return false; + } + int num_osds = osdmap.get_num_osds(); if (num_osds == 0) { dout(5) << __func__ << " no osds" << dendl; @@ -2540,6 +2561,13 @@ bool OSDMonitor::can_mark_in(int i) return false; } + if (osdmap.get_crush_node_flags(i) & CEPH_OSD_NOIN) { + dout(5) << __func__ << " osd." << i + << " is marked as noin via a crush node flag, " + << "will not mark it in" << dendl; + return false; + } + return true; }