]> git.apps.os.sepia.ceph.com Git - ceph.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, 4 Nov 2019 22:21:21 +0000 (14:21 -0800)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit f2b26d88f0a0727f0362ccd8b287f8bb3f41dc3c)

Conflicts:
src/osd/OSD.cc (trivial)

src/common/options.cc
src/osd/OSD.cc

index 889778c433dfc9381203ac9cc9189d3d0a07edaf..bae38494fdec586c5c60ed108f91af447c5a9ef6 100644 (file)
@@ -5535,6 +5535,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 935c5fa63b823696a6f7f61810b55b06b2573c0b..fc959e45a4a6db89b9f0e3f48fb9eda418d5863e 100644 (file)
@@ -5438,7 +5438,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;
+    }
     utime_t w;
     w.set_from_double(wait);
     dout(30) << "heartbeat_entry sleeping for " << wait << dendl;