From: Sage Weil Date: Mon, 9 Dec 2019 16:30:26 +0000 (-0600) Subject: Merge PR #31907 into master X-Git-Tag: v15.1.0~608 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f886610e449bb9c9ac1766a15f91a72ad004aa7c;p=ceph-ci.git Merge PR #31907 into master * refs/pull/31907/head: mgr/dashboard: properly handle a missing rbd-mirror service status mgr: cull service daemons when the last instance has been removed mgr: ensure new daemons are properly indexed by hostname Reviewed-by: Sage Weil Reviewed-by: Tatjana Dehler Reviewed-by: Ernesto Puerta --- f886610e449bb9c9ac1766a15f91a72ad004aa7c diff --cc src/mgr/DaemonServer.cc index 7b81ffff027,f7a7badaa51..4b41c35df88 --- a/src/mgr/DaemonServer.cc +++ b/src/mgr/DaemonServer.cc @@@ -398,27 -397,23 +398,33 @@@ bool DaemonServer::handle_open(const re DaemonStatePtr daemon; if (daemon_state.exists(key)) { + dout(20) << "updating existing DaemonState for " << key << dendl; daemon = daemon_state.get(key); } - if (m->service_daemon && !daemon) { - dout(4) << "constructing new DaemonState for " << key << dendl; - daemon = std::make_shared(daemon_state.types); - daemon->key = key; - daemon->service_daemon = true; - daemon_state.insert(daemon); + if (!daemon) { + if (m->service_daemon) { + dout(4) << "constructing new DaemonState for " << key << dendl; + daemon = std::make_shared(daemon_state.types); + daemon->key = key; + daemon->service_daemon = true; + daemon_state.insert(daemon); + } else { + /* A normal Ceph daemon has connected but we are or should be waiting on + * metadata for it. Close the session so that it tries to reconnect. + */ + dout(2) << "ignoring open from " << key << " " << con->get_peer_addr() + << "; not ready for session (expect reconnect)" << dendl; + con->mark_down(); + return true; + } } if (daemon) { - dout(20) << "updating existing DaemonState for " << m->daemon_name << dendl; + if (m->service_daemon) { + // update the metadata through the daemon state index to + // ensure it's kept up-to-date + daemon_state.update_metadata(daemon, m->daemon_metadata); + } + std::lock_guard l(daemon->lock); daemon->perf_counters.clear();