From a0400ae703c738a04906e7fd35f040eacb787249 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 5 Mar 2020 23:35:46 +0800 Subject: [PATCH] mgr: update "hostname" when we already have the daemon state from the same entity there is chance that we reuse the identity of a daemon and deploy the daemon on a different host. in that case, the existing daemon state should be updated with the new hostname. Fixes: https://tracker.ceph.com/issues/44446 Signed-off-by: Kefu Chai (cherry picked from commit e3d3d0501e5095ce557e2e4ccaefc294a7d5c08c) Conflicts: src/mgr/Mgr.cc: trivial resolution --- src/mgr/Mgr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index ab749b0257713..eb368307e4031 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -108,6 +108,8 @@ void MetadataUpdate::finish(int r) DaemonStatePtr state; if (daemon_state.exists(key)) { state = daemon_state.get(key); + state->hostname = daemon_meta.at("hostname").get_str(); + if (key.first == "mds" || key.first == "mgr" || key.first == "mon") { daemon_meta.erase("name"); } else if (key.first == "osd") { -- 2.39.5