From: John Spray Date: Thu, 29 Jun 2017 11:05:48 +0000 (-0400) Subject: mgr: wait for mon digest on startup X-Git-Tag: v12.1.1~26^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f25763208ff67867d45bcaa56b3dff7e80f755db;p=ceph.git mgr: wait for mon digest on startup 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 --- diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index ffc8e008ab0..cbbe24916a2 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -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() diff --git a/src/mgr/Mgr.h b/src/mgr/Mgr.h index 3638f5b1688..a129a43b91e 100644 --- a/src/mgr/Mgr.h +++ b/src/mgr/Mgr.h @@ -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;