From ec4da142d8d1e4d14a0419a3d607eb64e8e68e2b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 25 Jul 2020 13:04:58 +0800 Subject: [PATCH] crimson/mgr: only pick the addr of the same type to avoid the attempts to connect an OSD which is bound to a v2 address to a v1 address of a mgr. in general, osd is bound to both v1 and v2 addresses, but crimson msgr does not support multiple bound address at the time of writing, so to avoid the failures when trying to connect to incompatible addresses, let's filter out them when connecting to monitor. this change silence warnings like: peer_addr_for_me v1:172.21.15.106:60008/0 type doesn't match myaddr v2:0.0.0.0:6802/26710 Signed-off-by: Kefu Chai --- src/crimson/mgr/client.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/crimson/mgr/client.cc b/src/crimson/mgr/client.cc index c99a0c0f77c..e8666139dd8 100644 --- a/src/crimson/mgr/client.cc +++ b/src/crimson/mgr/client.cc @@ -103,7 +103,20 @@ seastar::future<> Client::reconnect() auto a_while = std::chrono::duration_cast( retry_interval); return seastar::sleep(a_while).then([this] { - auto peer = mgrmap.get_active_addrs().front(); + auto peer = [&] { + auto& mgr_addrs = mgrmap.get_active_addrs(); + if (msgr.get_myaddr().is_legacy()) { + return mgr_addrs.legacy_addr(); + } else { + return mgr_addrs.msgr2_addr(); + } + }(); + if (peer == entity_addr_t{}) { + // crimson msgr only uses the first bound addr + logger().error("mgr.{} does not have an addr compatible with me", + mgrmap.get_active_name()); + return; + } conn = msgr.connect(peer, CEPH_ENTITY_TYPE_MGR); }); } -- 2.39.5