]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Add debug_disable_randomized_ping config for use in testing
authorDavid Zafman <dzafman@redhat.com>
Wed, 24 Jul 2019 01:10:46 +0000 (18:10 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 26 Aug 2019 15:25:34 +0000 (15:25 +0000)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/common/options.cc
src/osd/OSD.cc

index 9f9d1fbe5ae5d06c76edb24c0b21cc29f9958032..731612d53270fdb856373d9b52c9f33c35043947 100644 (file)
@@ -5579,6 +5579,10 @@ std::vector<Option> get_global_options() {
     .set_description("")
     .add_service({"mon", "osd"})
     .set_long_description("This sets the gss target service name."),
+
+    Option("debug_disable_randomized_ping", Option::TYPE_BOOL, Option::LEVEL_DEV)
+    .set_default(false)
+    .set_description("Disable heartbeat ping randomization for testing purposes"),
   });
 }
 
index 0727e821986d6310732c03b7f473a3b6a0c963d9..1f01b7ed876d88176193be436378fa5425508662 100644 (file)
@@ -5031,7 +5031,12 @@ void OSD::heartbeat_entry()
   while (!heartbeat_stop) {
     heartbeat();
 
-    double wait = .5 + ((float)(rand() % 10)/10.0) * (float)cct->_conf->osd_heartbeat_interval;
+    double wait;
+    if (cct->_conf.get_val<bool>("debug_disable_randomized_ping")) {
+      wait = (float)cct->_conf->osd_heartbeat_interval;
+    } else {
+      wait = .5 + ((float)(rand() % 10)/10.0) * (float)cct->_conf->osd_heartbeat_interval;
+    }
     auto w = ceph::make_timespan(wait);
     dout(30) << "heartbeat_entry sleeping for " << wait << dendl;
     heartbeat_cond.wait_for(l, w);