From: John Spray Date: Thu, 29 Jun 2017 13:35:39 +0000 (-0400) Subject: mgr: send beacon to mon as soon as done with Mgr::init X-Git-Tag: v12.1.1~26^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e0e87da6529d2c7c785aebd2aca88a517e150d0c;p=ceph-ci.git mgr: send beacon to mon as soon as done with Mgr::init ...instead of waiting for next periodic beacon. Signed-off-by: John Spray --- diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index cbbe24916a2..11d03aae1f9 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -148,7 +148,7 @@ public: }; -void Mgr::background_init() +void Mgr::background_init(Context *completion) { Mutex::Locker l(lock); assert(!initializing); @@ -157,8 +157,9 @@ void Mgr::background_init() finisher.start(); - finisher.queue(new FunctionContext([this](int r){ + finisher.queue(new FunctionContext([this, completion](int r){ init(); + completion->complete(0); })); } diff --git a/src/mgr/Mgr.h b/src/mgr/Mgr.h index a129a43b91e..2ca63f800c6 100644 --- a/src/mgr/Mgr.h +++ b/src/mgr/Mgr.h @@ -94,7 +94,7 @@ public: void tick(); - void background_init(); + void background_init(Context *completion); void shutdown(); }; diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index a3c3234a208..0af01e68ba1 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -288,8 +288,14 @@ void MgrStandby::handle_mgr_map(MMgrMap* mmap) dout(1) << "Activating!" << dendl; active_mgr.reset(new Mgr(&monc, map, client_messenger.get(), &objecter, &client, clog, audit_clog)); - active_mgr->background_init(); - dout(1) << "I am now active" << dendl; + active_mgr->background_init(new FunctionContext( + [this](int r){ + // Advertise our active-ness ASAP instead of waiting for + // next tick. + Mutex::Locker l(lock); + send_beacon(); + })); + dout(1) << "I am now activating" << dendl; } else { dout(10) << "I was already active" << dendl; bool need_respawn = active_mgr->got_mgr_map(map);