]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/DaemonServer: keep daemon in service map when it has no tasks
authorKefu Chai <kchai@redhat.com>
Tue, 14 Jul 2020 09:48:59 +0000 (17:48 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 15 Jul 2020 04:36:33 +0000 (12:36 +0800)
we should not remove a daemon from service map even if it has no task
running, as it is not an evidence that the service is removed from the
cluster.

this change partially reverts 5a7d0632d989536e09b2d916b5ea9713dc8dbea5

Fixes: https://tracker.ceph.com/issues/46495
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/DaemonServer.cc

index a6227db275474284062383128a82ecfa7f38f932..99f255ec2e686c2152d2af55733c3b51ab07fdf1 100644 (file)
@@ -554,21 +554,10 @@ void DaemonServer::update_task_status(
 {
   dout(10) << "got task status from " << key << dendl;
 
-  bool service_map_dirty = false;
-  if (task_status.empty()) {
-    auto removed = pending_service_map.rm_daemon(key.type, key.name);
-    if (removed) {
-      service_map_dirty = true;
-    }
-  } else {
-    auto p = pending_service_map.get_daemon(key.type, key.name);
-    if (!map_compare(p.first->task_status, task_status)) {
-      service_map_dirty = true;
-      p.first->task_status = task_status;
-    }
-  }
-
-  if (service_map_dirty) {
+  [[maybe_unused]] auto [daemon, added] =
+    pending_service_map.get_daemon(key.type, key.name);
+  if (daemon->task_status != task_status) {
+    daemon->task_status = task_status;
     pending_service_map_dirty = pending_service_map.epoch;
   }
 }