]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: respect crush node flags for can_mark_*()
authorSage Weil <sage@redhat.com>
Fri, 12 Apr 2019 16:50:22 +0000 (11:50 -0500)
committerSage Weil <sage@redhat.com>
Tue, 16 Apr 2019 22:22:55 +0000 (17:22 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 79f0043208f9ba2d4cf02877e6f349b8d0ce55dc)

src/mon/OSDMonitor.cc

index 34b19664aed7f2234db0832ba9e1bbbe449332b9..2d9d86e29c7ce046d1539a915b09323917db3912 100644 (file)
@@ -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;
@@ -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;
 }
 
@@ -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;
@@ -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;
 }