]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: subscribe to config, handle updates
authorSage Weil <sage@redhat.com>
Sat, 2 Dec 2017 04:43:02 +0000 (22:43 -0600)
committerSage Weil <sage@redhat.com>
Tue, 6 Mar 2018 20:44:48 +0000 (14:44 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc
src/mon/MonClient.h

index 50fb3f74d75d0c6e5ea50ff00612b2981b3235b0..cee5bb206154dd274b9317470bfa70cb35d94142 100644 (file)
 #include <random>
 
 #include "include/scope_guard.h"
+#include "include/stringify.h"
 
 #include "messages/MMonGetMap.h"
 #include "messages/MMonGetVersion.h"
 #include "messages/MMonGetVersionReply.h"
 #include "messages/MMonMap.h"
+#include "messages/MConfig.h"
 #include "messages/MAuth.h"
 #include "messages/MLogAck.h"
 #include "messages/MAuthReply.h"
@@ -244,6 +246,7 @@ bool MonClient::ms_dispatch(Message *m)
   case CEPH_MSG_MON_GET_VERSION_REPLY:
   case MSG_MON_COMMAND_ACK:
   case MSG_LOGACK:
+  case MSG_CONFIG:
     break;
   default:
     return false;
@@ -299,6 +302,9 @@ bool MonClient::ms_dispatch(Message *m)
       m->put();
     }
     break;
+  case MSG_CONFIG:
+    handle_config(static_cast<MConfig*>(m));
+    break;
   }
   return true;
 }
@@ -349,6 +355,13 @@ void MonClient::handle_monmap(MMonMap *m)
   want_monmap = false;
 }
 
+void MonClient::handle_config(MConfig *m)
+{
+  ldout(cct,10) << __func__ << " " << *m << dendl;
+  cct->_conf->set_mon_vals(cct, m->config);
+  m->put();
+}
+
 // ----------------------
 
 int MonClient::init()
@@ -453,6 +466,7 @@ int MonClient::authenticate(double timeout)
   }
 
   _sub_want("monmap", monmap.get_epoch() ? monmap.get_epoch() + 1 : 0, 0);
+  _sub_want("config", 0, 0);
   if (!_opened())
     _reopen_session();
 
index 3dc95f71c7d497c80fa7c2c640edef7e2a9531f8..7ca35016892e95b7c43dfb63b4265059829858ed 100644 (file)
@@ -27,6 +27,7 @@
 
 
 class MMonMap;
+class MConfig;
 class MMonGetVersionReply;
 struct MMonSubscribeAck;
 class MMonCommandAck;
@@ -177,6 +178,7 @@ private:
   bool ms_handle_refused(Connection *con) override { return false; }
 
   void handle_monmap(MMonMap *m);
+  void handle_config(MConfig *m);
 
   void handle_auth(MAuthReply *m);