]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: embed a MgrClient
authorJohn Spray <john.spray@redhat.com>
Mon, 25 Jul 2016 16:03:15 +0000 (17:03 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:26:59 +0000 (17:26 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSDaemon.cc
src/mds/MDSDaemon.h

index c85769e4caa8424cf50e3f5a3c3323b6083beadd..e89319dcdbcdcfa4c432b0dec5d877b398ae06fa 100644 (file)
@@ -122,6 +122,7 @@ MDSDaemon::MDSDaemon(const std::string &n, Messenger *m, MonClient *mc) :
   name(n),
   messenger(m),
   monc(mc),
+  mgrc(m->cct, m),
   log_client(m->cct, messenger, &mc->monmap, LogClient::NO_FLAGS),
   mds_rank(NULL),
   tick_event(0),
@@ -470,7 +471,8 @@ int MDSDaemon::init()
   // get monmap
   monc->set_messenger(messenger);
 
-  monc->set_want_keys(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS);
+  monc->set_want_keys(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD |
+                      CEPH_ENTITY_TYPE_MDS | CEPH_ENTITY_TYPE_MGR);
   int r = 0;
   r = monc->init();
   if (r < 0) {
@@ -509,6 +511,9 @@ int MDSDaemon::init()
     return -ETIMEDOUT;
   }
 
+  mgrc.init();
+  messenger->add_dispatcher_head(&mgrc);
+
   mds_lock.Lock();
   if (beacon.get_want_state() == CEPH_MDS_STATE_DNE) {
     dout(4) << __func__ << ": terminated already, dropping out" << dendl;
@@ -517,6 +522,7 @@ int MDSDaemon::init()
   }
 
   monc->sub_want("mdsmap", 0, 0);
+  monc->sub_want("mgrmap", 0, 0);
   monc->renew_subs();
 
   mds_lock.Unlock();
@@ -1089,6 +1095,7 @@ void MDSDaemon::suicide()
   } else {
     timer.shutdown();
 
+    mgrc.shutdown();
     monc->shutdown();
     messenger->shutdown();
   }
index c940ec682fac837219ab290eb595fbf0f91d92ae..375cf8abaaec5264a9b414cbb11e16ec7a4a7b54 100644 (file)
@@ -32,6 +32,7 @@
 #include "common/TrackedOp.h"
 #include "common/Finisher.h"
 #include "common/cmdparse.h"
+#include "mgr/MgrClient.h"
 
 #include "MDSRank.h"
 #include "MDSMap.h"
@@ -81,6 +82,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t {
 
   Messenger    *messenger;
   MonClient    *monc;
+  MgrClient     mgrc;
   MDSMap       *mdsmap;
   LogClient    log_client;
   LogChannelRef clog;