From 79f0043208f9ba2d4cf02877e6f349b8d0ce55dc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 Apr 2019 11:50:22 -0500 Subject: [PATCH] mon/OSDMonitor: respect crush node flags for can_mark_*() Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ef807bf37543..c31f480260ba 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; } -- 2.47.3