]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: ensure new daemons are properly indexed by hostname
authorJason Dillaman <dillaman@redhat.com>
Wed, 27 Nov 2019 14:32:28 +0000 (09:32 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 9 Dec 2019 16:43:08 +0000 (11:43 -0500)
The hostname key was never populated when storing a daemon within
the daemon state index for the first time. This results in the
"by_server" index being incorrect.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 3e7bc80b35b43d495a56b9cb0e9e15f58381f77b)

src/mgr/DaemonServer.cc

index 0bb21d8587d4dab742e2e575fb112d1fc8d8a275..da02925f0f92615be97bc62b0faff4a9e2832e6a 100644 (file)
@@ -425,6 +425,7 @@ bool DaemonServer::handle_open(MMgrOpen *m)
 
   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) {
@@ -435,12 +436,16 @@ bool DaemonServer::handle_open(MMgrOpen *m)
     daemon_state.insert(daemon);
   }
   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();
 
     if (m->service_daemon) {
-      daemon->set_metadata(m->daemon_metadata);
       daemon->service_status = m->daemon_status;
 
       utime_t now = ceph_clock_now();