crush.finalize();
}
-void OSDMap::build_simple_from_conf(CephContext *cct, epoch_t e, uuid_d &fsid,
- int pg_bits, int pgp_bits)
+int OSDMap::build_simple_from_conf(CephContext *cct, epoch_t e, uuid_d &fsid,
+ int pg_bits, int pgp_bits)
{
ldout(cct, 10) << "build_simple_from_conf with "
<< pg_bits << " pg bits per osd, "
if (*end != '\0')
continue;
+ if (o > cct->_conf->mon_max_osd) {
+ lderr(cct) << "[osd." << o << "] in config has id > mon_max_osd " << cct->_conf->mon_max_osd << dendl;
+ return -ERANGE;
+ }
numosd++;
if (o > maxosd)
maxosd = o;
set_state(i, 0);
set_weight(i, CEPH_OSD_OUT);
}
+
+ return 0;
}
void OSDMap::build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& crush,
*/
void build_simple(CephContext *cct, epoch_t e, uuid_d &fsid,
int num_osd, int pg_bits, int pgp_bits);
- void build_simple_from_conf(CephContext *cct, epoch_t e, uuid_d &fsid,
- int pg_bits, int pgp_bits);
+ int build_simple_from_conf(CephContext *cct, epoch_t e, uuid_d &fsid,
+ int pg_bits, int pgp_bits);
static void build_simple_crush_map(CephContext *cct, CrushWrapper& crush,
map<int, const char*>& poolsets, int num_osd);
static void build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& crush,
if (create_from_conf) {
uuid_d fsid;
memset(&fsid, 0, sizeof(uuid_d));
- osdmap.build_simple_from_conf(g_ceph_context, 0, fsid, pg_bits, pgp_bits);
+ int r = osdmap.build_simple_from_conf(g_ceph_context, 0, fsid, pg_bits, pgp_bits);
+ if (r < 0)
+ return -1;
modified = true;
}