From e3d3d0501e5095ce557e2e4ccaefc294a7d5c08c 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 --- src/mgr/Mgr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mgr/Mgr.cc b/src/mgr/Mgr.cc index 80d05ed5301d2..da24a24d0bf8d 100644 --- a/src/mgr/Mgr.cc +++ b/src/mgr/Mgr.cc @@ -103,6 +103,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.type == "mds" || key.type == "mgr" || key.type == "mon") { daemon_meta.erase("name"); } else if (key.type == "osd") { -- 2.39.5