]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: respect crush node flags for can_mark_*() 27563/head
authorSage Weil <sage@redhat.com>
Fri, 12 Apr 2019 16:50:22 +0000 (11:50 -0500)
committerSage Weil <sage@redhat.com>
Fri, 12 Apr 2019 16:50:22 +0000 (11:50 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index ef807bf3754325c4d41954f8e4bd7da9218e1103..c31f480260baba935f44d208b12dbe7fc5b16525 100644 (file)
@@ -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;
 }