]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: allow row, room, datacenter, pool in conf for initial crush map
authorSage Weil <sage.weil@dreamhost.com>
Wed, 4 Apr 2012 00:03:54 +0000 (17:03 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 4 Apr 2012 00:03:54 +0000 (17:03 -0700)
These work just like host and rack, except that they are optional.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/OSDMap.cc

index 42c0608f9301fe0861d0f7b8040054b264ff8f96..b98dcfa68fd06b1e897e9a7f9e6084386c1cc7f2 100644 (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;