From: John Spray Date: Thu, 4 Aug 2016 21:07:33 +0000 (+0100) Subject: mon: implement MgrMonitor.preprocess_beacon X-Git-Tag: v11.0.1~60^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7b8179bd5d455a6d9a8475593fa097736b436790;p=ceph.git mon: implement MgrMonitor.preprocess_beacon So that we're not throwing out new mgrmap epochs every beacon. Signed-off-by: John Spray --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 4e34edfdce9..109354731b4 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -98,12 +98,7 @@ bool MgrMonitor::prepare_update(MonOpRequestRef op) } } -bool MgrMonitor::preprocess_beacon(MonOpRequestRef op) -{ - //MMgrBeacon *m = static_cast(op->get_req()); - return false; -} class C_Updated : public Context { MgrMonitor *mm; @@ -122,6 +117,29 @@ public: } }; +bool MgrMonitor::preprocess_beacon(MonOpRequestRef op) +{ + MMgrBeacon *m = static_cast(op->get_req()); + dout(4) << "beacon from " << m->get_gid() << dendl; + + last_beacon[m->get_gid()] = ceph_clock_now(g_ceph_context); + + if (pending_map.active_gid == m->get_gid() + && pending_map.active_addr == m->get_server_addr() + && pending_map.get_available() == m->get_available()) { + dout(4) << "Daemon already active in map" << dendl; + return true; + } + + if (pending_map.standbys.count(m->get_gid()) > 0 + && pending_map.active_gid != 0) { + dout(4) << "Daemon already standby in map" << dendl; + return true; + } + + return false; +} + bool MgrMonitor::prepare_beacon(MonOpRequestRef op) { MMgrBeacon *m = static_cast(op->get_req());