]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: switch from send_beacon() to tick()
authorGreg Farnum <gfarnum@redhat.com>
Fri, 10 Mar 2017 23:02:50 +0000 (15:02 -0800)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 16:58:15 +0000 (12:58 -0400)
We are about to want similar time-based stuff in our other
classes and it's simplest to coalesce them into a single wakeup.

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/common/config_opts.h
src/mgr/MgrStandby.cc
src/mgr/MgrStandby.h

index f693913bf99ea11f187d65d65bb289523d0f6196..7bfe8c0864af4d8a8f6077aea907d245c61f9dbf 100644 (file)
@@ -1685,8 +1685,8 @@ OPTION(rgw_swift_versioning_enabled, OPT_BOOL, false) // whether swift object ve
 OPTION(mgr_module_path, OPT_STR, CEPH_PKGLIBDIR "/mgr") // where to load python modules from
 OPTION(mgr_modules, OPT_STR, "restful")  // Which modules to load
 OPTION(mgr_data, OPT_STR, "/var/lib/ceph/mgr/$cluster-$id") // where to find keyring etc
-OPTION(mgr_beacon_period, OPT_INT, 5)  // How frequently to send beacon
-OPTION(mgr_stats_period, OPT_INT, 5) // How frequently to send stats
+OPTION(mgr_tick_period, OPT_INT, 5)  // How frequently to tick
+OPTION(mgr_stats_period, OPT_INT, 5) // How frequently clients send stats
 OPTION(mgr_client_bytes, OPT_U64, 128*1048576) // bytes from clients
 OPTION(mgr_client_messages, OPT_U64, 512)      // messages from clients
 OPTION(mgr_osd_bytes, OPT_U64, 512*1048576)   // bytes from osds
index bc946e41c18c9d7968e538629c1b618c7d69b0e9..d94e3fd68655acb166ec72b02e3af2ee1a594961 100644 (file)
@@ -134,7 +134,7 @@ int MgrStandby::init()
   client.init();
   timer.init();
 
-  send_beacon();
+  tick();
 
   dout(4) << "Complete." << dendl;
   return 0;
@@ -155,9 +155,15 @@ void MgrStandby::send_beacon()
                                  available);
                                  
   monc.send_mon_message(m);
-  timer.add_event_after(g_conf->mgr_beacon_period, new FunctionContext(
+}
+
+void MgrStandby::tick()
+{
+  send_beacon();
+
+  timer.add_event_after(g_conf->mgr_tick_period, new FunctionContext(
         [this](int r){
-          send_beacon();
+          tick();
         }
   )); 
 }
index 8698e92a7dea1478ef85001eef6c5bdf5b5b706d..8c1c144e73ff45c94dac302b6f395f941f32b145 100644 (file)
@@ -59,6 +59,7 @@ protected:
 
   void handle_mgr_map(MMgrMap *m);
   void _update_log_config();
+  void send_beacon();
 
 public:
   MgrStandby();
@@ -75,7 +76,7 @@ public:
   void shutdown();
   int main(vector<const char *> args);
   void handle_signal(int signum);
-  void send_beacon();
+  void tick();
 };
 
 #endif