]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: wait for mon digest on startup
authorJohn Spray <john.spray@redhat.com>
Thu, 29 Jun 2017 11:05:48 +0000 (07:05 -0400)
committerJohn Spray <john.spray@redhat.com>
Tue, 4 Jul 2017 23:07:04 +0000 (19:07 -0400)
This is to avoid starting the python modules
before the mon_status and health information
is available.

Fixes: http://tracker.ceph.com/issues/20383
Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/Mgr.cc
src/mgr/Mgr.h

index ffc8e008ab025de23357ae0c1e49fc0b1612c27c..cbbe24916a2f3c8c7b797ea370e5bd8cfa5e0400 100644 (file)
@@ -49,6 +49,7 @@ Mgr::Mgr(MonClient *monc_, const MgrMap& mgrmap,
   lock("Mgr::lock"),
   timer(g_ceph_context, lock),
   finisher(g_ceph_context, "Mgr", "mgr-fin"),
+  digest_received(false),
   py_modules(daemon_state, cluster_state, *monc, clog_, *objecter, *client,
              finisher),
   cluster_state(monc, nullptr, mgrmap),
@@ -218,8 +219,10 @@ void Mgr::init()
   // all sets will come via mgr)
   load_config();
 
-  // Wait for MgrDigest...?
-  // TODO
+  // Wait for MgrDigest...
+  while(!digest_received) {
+    digest_cond.Wait(lock);
+  }
 
   // assume finisher already initialized in background_init
 
@@ -600,6 +603,11 @@ void Mgr::handle_mgr_digest(MMgrDigest* m)
   dout(10) << "done." << dendl;
 
   m->put();
+
+  if (!digest_received) {
+    digest_received = true;
+    digest_cond.Signal();
+  }
 }
 
 void Mgr::tick()
index 3638f5b16884f55e7860076b1de0a1713bc195ee..a129a43b91e52fd61e8de139a8908edd96f2fdd0 100644 (file)
@@ -56,7 +56,10 @@ protected:
   SafeTimer timer;
   Finisher finisher;
 
+  // Track receipt of initial data during startup
   Cond fs_map_cond;
+  bool digest_received;
+  Cond digest_cond;
 
   PyModules py_modules;
   DaemonStateIndex daemon_state;