]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap: no need to give same locations per time to create bucket
authorChangcheng Liu <changcheng.liu@aliyun.com>
Wed, 26 Aug 2020 01:52:57 +0000 (09:52 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Sun, 6 Sep 2020 13:01:52 +0000 (21:01 +0800)
Suggested-by: Kefu Chai <kefu@redhat.com>
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/osd/OSDMap.cc

index f54f00baa64bfb987128b3a4564251e5cb8a6593..f7a70aaefd9633d29a86a4090bd1f8ef07eba3ce 100644 (file)
@@ -4234,11 +4234,12 @@ int OSDMap::build_simple_crush_map(CephContext *cct, CrushWrapper& crush,
   ceph_assert(r == 0);
   crush.set_item_name(rootid, "default");
 
+  map<string,string> loc{
+    {"host", "localhost"},
+    {"rack", "localrack"},
+    {"root", "default"}
+  };
   for (int o=0; o<nosd; o++) {
-    map<string,string> loc;
-    loc["host"] = "localhost";
-    loc["rack"] = "localrack";
-    loc["root"] = "default";
     ldout(cct, 10) << " adding osd." << o << " at " << loc << dendl;
     char name[32];
     snprintf(name, sizeof(name), "osd.%d", o);