Use this in the Manager so it can notify of new monitor maps.
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
handle_mgr_digest(static_cast<MMgrDigest*>(m));
break;
case CEPH_MSG_MON_MAP:
- // FIXME: we probably never get called here because MonClient
- // has consumed the message. For consuming OSDMap we need
- // to be the tail dispatcher, but to see MonMap we would
- // need to be at the head.
- // Result is that ClusterState has access to monmap (it reads
- // from monclient anyway), but we don't see notifications. Hook
- // into MonClient to get notifications instead of messing
- // with message delivery to achieve it?
- ceph_abort();
-
py_modules.notify_all("mon_map", "");
m->put();
break;
Dispatcher(cct_),
messenger(NULL),
monc_lock("MonClient::monc_lock"),
- timer(cct_, monc_lock), finisher(cct_),
+ timer(cct_, monc_lock),
+ finisher(cct_),
initialized(false),
no_keyring_disabled_cephx(false),
log_client(NULL),
switch (m->get_type()) {
case CEPH_MSG_MON_MAP:
handle_monmap(static_cast<MMonMap*>(m));
+ if (passthrough_monmap) {
+ return false;
+ } else {
+ m->put();
+ }
break;
case CEPH_MSG_AUTH_REPLY:
handle_auth(static_cast<MAuthReply*>(m));
send_log();
}
+/* Unlike all the other message-handling functions, we don't put away a reference
+* because we want to support MMonMap passthrough to other Dispatchers. */
void MonClient::handle_monmap(MMonMap *m)
{
ldout(cct, 10) << __func__ << " " << *m << dendl;
map_cond.Signal();
want_monmap = false;
-
- m->put();
}
// ----------------------
// monclient
bool want_monmap;
Cond map_cond;
-private:
+ bool passthrough_monmap = false;
+
// authenticate
std::unique_ptr<AuthClientHandler> auth;
uint32_t want_keys = 0;
int build_initial_monmap();
int get_monmap();
int get_monmap_privately();
+ /**
+ * If you want to see MonMap messages, set this and
+ * the MonClient will tell the Messenger it hasn't
+ * dealt with it.
+ * Note that if you do this, *you* are of course responsible for
+ * putting the message reference!
+ */
+ void set_passthrough_monmap() {
+ Mutex::Locker l(monc_lock);
+ passthrough_monmap = true;
+ }
+ void unset_passthrough_monmap() {
+ Mutex::Locker l(monc_lock);
+ passthrough_monmap = false;
+ }
/**
* Ping monitor with ID @p mon_id and record the resulting
* reply in @p result_reply.