From: Sage Weil Date: Fri, 14 Jul 2017 15:39:31 +0000 (-0400) Subject: mon: add mon_osd_crush_smoke_test=true X-Git-Tag: v12.1.1~6^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=75c923e7a0163c70f8f45360a27be05eb9042655;p=ceph.git mon: add mon_osd_crush_smoke_test=true This option allows us to disable the crush smoke test when creating pools, injecting crush maps, or making other changes. DANGER DANGER. Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 15dc65600e04..b13fa80c8c28 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -395,6 +395,7 @@ OPTION(mon_keyvaluedb, OPT_STR, "rocksdb") // type of keyvaluedb backend // UNSAFE -- TESTING ONLY! Allows addition of a cache tier with preexisting snaps OPTION(mon_debug_unsafe_allow_tier_with_nonempty_snaps, OPT_BOOL, false) OPTION(mon_osd_blacklist_default_expire, OPT_DOUBLE, 60*60) // default one hour +OPTION(mon_osd_crush_smoke_test, OPT_BOOL, true) OPTION(paxos_stash_full_interval, OPT_INT, 25) // how often (in commits) to stash a full copy of the PaxosService state OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 4a613ae8843b..4f05449bc11b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -5597,18 +5597,20 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, dout(10) << " prepare_pool_crush_rule returns " << r << dendl; return r; } - CrushWrapper newcrush; - _get_pending_crush(newcrush); - ostringstream err; - CrushTester tester(newcrush, err); - tester.set_max_x(50); - tester.set_rule(crush_rule); - r = tester.test_with_fork(g_conf->mon_lease); - if (r < 0) { - dout(10) << " tester.test_with_fork returns " << r - << ": " << err.str() << dendl; - *ss << "crush test failed with " << r << ": " << err.str(); - return r; + if (g_conf->mon_osd_crush_smoke_test) { + CrushWrapper newcrush; + _get_pending_crush(newcrush); + ostringstream err; + CrushTester tester(newcrush, err); + tester.set_max_x(50); + tester.set_rule(crush_rule); + r = tester.test_with_fork(g_conf->mon_lease); + if (r < 0) { + dout(10) << " tester.test_with_fork returns " << r + << ": " << err.str() << dendl; + *ss << "crush test failed with " << r << ": " << err.str(); + return r; + } } unsigned size, min_size; r = prepare_pool_size(pool_type, erasure_code_profile, &size, &min_size, ss); @@ -7005,22 +7007,24 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, } } - // sanity check: test some inputs to make sure this map isn't totally broken - dout(10) << " testing map" << dendl; - stringstream ess; - CrushTester tester(crush, ess); - tester.set_max_x(50); - int r = tester.test_with_fork(g_conf->mon_lease); - if (r < 0) { - dout(10) << " tester.test_with_fork returns " << r - << ": " << ess.str() << dendl; - ss << "crush smoke test failed with " << r << ": " << ess.str(); - err = r; - goto reply; + if (g_conf->mon_osd_crush_smoke_test) { + // sanity check: test some inputs to make sure this map isn't + // totally broken + dout(10) << " testing map" << dendl; + stringstream ess; + CrushTester tester(crush, ess); + tester.set_max_x(50); + int r = tester.test_with_fork(g_conf->mon_lease); + if (r < 0) { + dout(10) << " tester.test_with_fork returns " << r + << ": " << ess.str() << dendl; + ss << "crush smoke test failed with " << r << ": " << ess.str(); + err = r; + goto reply; + } + dout(10) << " crush test result " << ess.str() << dendl; } - dout(10) << " result " << ess.str() << dendl; - pending_inc.crush = data; ss << osdmap.get_crush_version() + 1; goto update;