osdmap: allow row, room, datacenter, pool in conf for initial crush map

These work just like host and rack, except that they are optional.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
Sage Weil 2012-04-03 17:03:54 -07:00
parent 4313a2d8da
commit b9185bb2e6

View File

@ -1262,13 +1262,16 @@ void OSDMap::build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& cr
if (*end != '\0')
continue;
string host;
string rack;
string host, rack, row, room, dc, pool;
vector<string> sections;
sections.push_back("osd");
sections.push_back(*i);
conf->get_val_from_conf_file(sections, "host", host, false);
conf->get_val_from_conf_file(sections, "rack", rack, false);
conf->get_val_from_conf_file(sections, "row", row, false);
conf->get_val_from_conf_file(sections, "room", room, false);
conf->get_val_from_conf_file(sections, "datacenter", dc, false);
conf->get_val_from_conf_file(sections, "pool", pool, false);
if (host.length() == 0)
host = "unknownhost";
@ -1281,6 +1284,12 @@ void OSDMap::build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& cr
map<string,string> loc;
loc["host"] = host;
loc["rack"] = rack;
if (row.size())
loc["row"] = row;
if (room.size())
loc["room"] = room;
if (dc.size())
loc["datacenter"] = dc;
loc["pool"] = "default";
ldout(cct, 0) << " adding osd." << o << " at " << loc << dendl;