Skip to content

Commit

Permalink
mon/OSDMonitor: respect crush node flags for can_mark_*()
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 79f0043)
  • Loading branch information
liewegas committed Apr 16, 2019
1 parent 8d9a321 commit d20a4bf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/mon/OSDMonitor.cc
Expand Up @@ -2448,6 +2448,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;
Expand Down Expand Up @@ -2478,6 +2485,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;
}

Expand All @@ -2498,6 +2512,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;
Expand Down Expand Up @@ -2534,6 +2555,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;
}

Expand Down

0 comments on commit d20a4bf

Please sign in to comment.