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;
}
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);
}
// 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);
}
}
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); }
return osd_info[osd].down_at;
}
osd_info_t& get_info(int osd) {
- assert(exists(osd));
+ assert(osd < max_osd);
return osd_info[osd];
}