]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: initially osds don't exist; create them as they boot
authorSage Weil <sage@newdream.net>
Thu, 6 May 2010 22:27:07 +0000 (15:27 -0700)
committerSage Weil <sage@newdream.net>
Thu, 6 May 2010 22:27:07 +0000 (15:27 -0700)
src/mon/OSDMonitor.cc
src/osd/OSDMap.cc
src/osd/OSDMap.h

index 24c15feffa1602d79dfcb2b89cd76698560af8dd..9c1cf2af11407dd011784fda4efe79b19f1d19bc 100644 (file)
@@ -434,8 +434,8 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
   int from = m->get_orig_source().num();
   
   // does this osd exist?
-  if (!osdmap.exists(from)) {
-    dout(1) << "boot from non-existent osd" << from << ", increase max_osd?" << dendl;
+  if (from >= osdmap.get_max_osd()) {
+    dout(1) << "boot from osd" << from << " >= max_osd " << osdmap.get_max_osd() << dendl;
     m->put();
     return false;
   }
index 5cea2a58b6d521f70fde31ce8091ee43ce68d575..de706e03096ce6d23068f0b42cae312360bffb43 100644 (file)
@@ -119,7 +119,7 @@ void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid,
   build_simple_crush_map(crush, rulesets, num_osd, num_dom);
 
   for (int i=0; i<num_osd; i++) {
-    set_state(i, CEPH_OSD_EXISTS);
+    set_state(i, 0);
     set_weight(i, CEPH_OSD_OUT);
   }
   
@@ -128,7 +128,7 @@ void OSDMap::build_simple(epoch_t e, ceph_fsid_t &fsid,
 
     // add mds local osds, but don't put them in the crush mapping func
     for (int i=0; i<mds_local_osd; i++) {
-      set_state(i+num_osd, CEPH_OSD_EXISTS);
+      set_state(i+num_osd, 0);
       set_weight(i+num_osd, CEPH_OSD_OUT);
     }
   }
index 9469f8acc06fb105d0a769ef8b1798f985e76949..102974993e9941707a9385a7aaa1b0a166f53808 100644 (file)
@@ -400,7 +400,7 @@ private:
 
   bool exists(int osd) { return osd < max_osd && (osd_state[osd] & CEPH_OSD_EXISTS); }
   bool is_up(int osd) { return exists(osd) && osd_state[osd] & CEPH_OSD_UP; }
-  bool is_down(int osd) { assert(exists(osd)); return !is_up(osd); }
+  bool is_down(int osd) { return !exists(osd) || !is_up(osd); }
   bool is_out(int osd) { return !exists(osd) || get_weight(osd) == CEPH_OSD_OUT; }
   bool is_in(int osd) { return exists(osd) && !is_out(osd); }
   
@@ -463,7 +463,7 @@ private:
     return osd_info[osd].down_at;
   }
   osd_info_t& get_info(int osd) {
-    assert(exists(osd));
+    assert(osd < max_osd);
     return osd_info[osd];
   }