]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: spread replicas across hosts with default crush map
authorSage Weil <sage@inktank.com>
Sat, 12 Jan 2013 01:23:22 +0000 (17:23 -0800)
committerGreg Farnum <greg@inktank.com>
Sat, 12 Jan 2013 01:10:24 +0000 (17:10 -0800)
This is more often the case than not, and we don't have a good way to
magically know what size of cluster the user will be creating.  Better to
err on the side of doing the right thing for more people.

Fixes: #3785
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/osd/OSDMap.cc

index 63a1fae809bc45524fa9512aa68e488f5970cef4..93ecb6055b6d8431bd58ed2b11cd8edf38d7cdb2 100644 (file)
@@ -1680,8 +1680,8 @@ void OSDMap::build_simple_crush_map(CephContext *cct, CrushWrapper& crush,
     crush_rule *rule = crush_make_rule(3, ruleset, pg_pool_t::TYPE_REP, minrep, maxrep);
     assert(rule);
     crush_rule_set_step(rule, 0, CRUSH_RULE_TAKE, rootid, 0);
-    // just spread across osds
-    crush_rule_set_step(rule, 1, CRUSH_RULE_CHOOSE_FIRSTN, CRUSH_CHOOSE_N, 0);
+    // spread across hosts
+    crush_rule_set_step(rule, 1, CRUSH_RULE_CHOOSE_LEAF_FIRSTN, CRUSH_CHOOSE_N, 1);
     crush_rule_set_step(rule, 2, CRUSH_RULE_EMIT, 0, 0);
     int rno = crush_add_rule(crush.crush, rule, -1);
     crush.set_rule_name(rno, p->second);