Skip to content

Commit

Permalink
mgr: introduce tick() calls through the system
Browse files Browse the repository at this point in the history
Still empty for the moment

Signed-off-by: Greg Farnum <[email protected]>
  • Loading branch information
gregsfortytwo authored and liewegas committed Jun 2, 2017
1 parent efbe466 commit ff1258e
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/messages/MMonMgrReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MMonMgrReport : public PaxosServiceMessage {
~MMonMgrReport() override {}

public:

bool needs_send = false;
const char *get_type_name() const override { return "monmgrreport"; }

void print(ostream& out) const override {
Expand Down
5 changes: 5 additions & 0 deletions src/mgr/ClusterState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include "messages/MMgrDigest.h"
#include "messages/MMonMgrReport.h"
#include "messages/MPGStats.h"

#include "mgr/ClusterState.h"
Expand Down Expand Up @@ -113,3 +114,7 @@ void ClusterState::notify_osdmap(const OSDMap &osd_map)
// while the full-blown PGMap lives only here.
}

void ClusterState::tick(MMonMgrReport *m)
{
dout(0) << __func__ << dendl;
}
3 changes: 3 additions & 0 deletions src/mgr/ClusterState.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "mon/PGMap.h"

class MMgrDigest;
class MMonMgrReport;
class MPGStats;


Expand Down Expand Up @@ -57,6 +58,8 @@ class ClusterState

void notify_osdmap(const OSDMap &osd_map);

void tick(MMonMgrReport *m);

bool have_fsmap() const {
Mutex::Locker l(lock);
return fsmap.get_epoch() > 0;
Expand Down
2 changes: 2 additions & 0 deletions src/mgr/DaemonServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

class MMgrReport;
class MMgrOpen;
class MMonMgrReport;
class MCommand;
struct MgrCommand;

Expand Down Expand Up @@ -111,6 +112,7 @@ class DaemonServer : public Dispatcher
bool handle_open(MMgrOpen *m);
bool handle_report(MMgrReport *m);
bool handle_command(MCommand *m);
void tick(MMonMgrReport *m) {}
};

#endif
Expand Down
12 changes: 12 additions & 0 deletions src/mgr/Mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "DaemonServer.h"
#include "messages/MMgrBeacon.h"
#include "messages/MMgrDigest.h"
#include "messages/MMonMgrReport.h"
#include "messages/MCommand.h"
#include "messages/MCommandReply.h"
#include "messages/MLog.h"
Expand Down Expand Up @@ -583,3 +584,14 @@ void Mgr::handle_mgr_digest(MMgrDigest* m)
m->put();
}

void Mgr::tick()
{
dout(0) << __func__ << dendl;
MMonMgrReport *m = new MMonMgrReport();
cluster_state.tick(m);
server.tick(m);
// TODO? We currently do not notify the PyModules
if (m->needs_send) {
monc->send_mon_message(m);
}
}
2 changes: 2 additions & 0 deletions src/mgr/Mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class Mgr {

bool ms_dispatch(Message *m);

void tick();

void background_init();
void shutdown();
};
Expand Down
5 changes: 5 additions & 0 deletions src/mgr/MgrStandby.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ void MgrStandby::send_beacon()

void MgrStandby::tick()
{
dout(0) << __func__ << dendl;
send_beacon();

if (active_mgr) {
active_mgr->tick();
}

timer.add_event_after(g_conf->mgr_tick_period, new FunctionContext(
[this](int r){
tick();
Expand Down

0 comments on commit ff1258e

Please sign in to comment.