On Thursday, May 24, 2012 at 10:58 AM, Adam Crume wrote: > I'm trying to simulate adding an OSD to a cluster. I set up an > OSDMap::Incremental and apply it, but nothing ever gets mapped to the > new OSD. Apparently, the crush map never gets updated. Do I have to > do that manually? Yes. If you need help, check out the OSDMonitor::prepare_command code "crush" section. :) > It seems like apply_incremental should do it > automatically. apply_incremental has no idea where the new ID is located in terms of failure domains. > My test case is below. It shows that the OSDMap is > updated to have 11 OSDs, but the crush map still shows only 10. > > Thanks, > Adam Crume > > #include <assert.h> > #include "osd/OSDMap.h" > #include "common/code_environment.h" > > int main() { > OSDMap *osdmap = new OSDMap(); > CephContext *cct = new CephContext(CODE_ENVIRONMENT_UTILITY); > uuid_d fsid; > int num_osds = 10; > osdmap->build_simple(cct, 1, fsid, num_osds, 7, 8); > for(int i = 0; i < num_osds; i++) { > osdmap->set_state(i, osdmap->get_state(i) | CEPH_OSD_UP | > CEPH_OSD_EXISTS); > osdmap->set_weight(i, CEPH_OSD_IN); > } > > int osd_num = 10; > OSDMap::Incremental inc(osdmap->get_epoch() + 1); > inc.new_max_osd = osdmap->get_max_osd() + 1; > inc.new_weight[osd_num] = CEPH_OSD_IN; > inc.new_state[osd_num] = CEPH_OSD_UP | CEPH_OSD_EXISTS; > inc.new_up_client[osd_num] = entity_addr_t(); > inc.new_up_internal[osd_num] = entity_addr_t(); > inc.new_hb_up[osd_num] = entity_addr_t(); > inc.new_up_thru[osd_num] = inc.epoch; > uuid_d new_uuid; > new_uuid.generate_random(); > inc.new_uuid[osd_num] = new_uuid; > int e = osdmap->apply_incremental(inc); > assert(e == 0); > printf("State for 10: %d, State for 0: %d\n", > osdmap->get_state(10), osdmap->get_state(0)); > printf("10 exists: %s\n", osdmap->exists(10) ? "yes" : "no"); > printf("10 is in: %s\n", osdmap->is_in(10) ? "yes" : "no"); > printf("10 is up: %s\n", osdmap->is_up(10) ? "yes" : "no"); > printf("OSDMap max OSD: %d\n", osdmap->get_max_osd()); > printf("CRUSH max devices: %d\n", osdmap->crush->get_max_devices()); > } > -- > To unsubscribe from this list: send the line "unsubscribe ceph-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx (mailto:majordomo@xxxxxxxxxxxxxxx) > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html