mgr: switch from send_beacon() to tick()

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>
This commit is contained in:
Greg Farnum 2017-03-10 15:02:50 -08:00 committed by Sage Weil
parent 8d803e0483
commit 35fd964ec0
3 changed files with 13 additions and 6 deletions

View 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

View 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();
}
));
}

View 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