]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add mon_osd_crush_smoke_test=true
authorSage Weil <sage@redhat.com>
Fri, 14 Jul 2017 15:39:31 +0000 (11:39 -0400)
committerSage Weil <sage@redhat.com>
Fri, 14 Jul 2017 15:51:47 +0000 (11:51 -0400)
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 <sage@redhat.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc

index 15dc65600e0437615f8b533f04e89b68bfd8c4c2..b13fa80c8c2807a10dfa156c2cf6ae2e1f6112f4 100644 (file)
@@ -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
index 4a613ae8843bc85ac0d7c8db72d620c2ff0d82a5..4f05449bc11b7ab6d0b23c6ac30460f2fbb06e85 100644 (file)
@@ -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;