]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: send beacon to mon as soon as done with Mgr::init
authorJohn Spray <john.spray@redhat.com>
Thu, 29 Jun 2017 13:35:39 +0000 (09:35 -0400)
committerJohn Spray <john.spray@redhat.com>
Tue, 4 Jul 2017 23:07:58 +0000 (19:07 -0400)
...instead of waiting for next periodic beacon.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/Mgr.cc
src/mgr/Mgr.h
src/mgr/MgrStandby.cc

index cbbe24916a2f3c8c7b797ea370e5bd8cfa5e0400..11d03aae1f93a5c46b2236364b52b32fb5edc1cb 100644 (file)
@@ -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);
   }));
 }
 
index a129a43b91e52fd61e8de139a8908edd96f2fdd0..2ca63f800c60f992de3ac0261c39aef7836999cb 100644 (file)
@@ -94,7 +94,7 @@ public:
 
   void tick();
 
-  void background_init();
+  void background_init(Context *completion);
   void shutdown();
 };
 
index a3c3234a20821b1659109d05885018ff0f5496c6..0af01e68ba1b1791b1a01920ea4b4e6460819ee1 100644 (file)
@@ -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);