]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: only pick the addr of the same type
authorKefu Chai <kchai@redhat.com>
Sat, 25 Jul 2020 04:38:04 +0000 (12:38 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 27 Jul 2020 03:29:10 +0000 (11:29 +0800)
to avoid the attempts to connect an OSD which is bound to a v2 address
to a v1 addrss of a monitor.

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 <kchai@redhat.com>
src/crimson/mon/MonClient.cc

index 99e9d3f2480d6de1667cef5f18b01b6b89584cd4..403774b03f920565a3ea79a234e75d6eeeb775e0 100644 (file)
@@ -957,7 +957,19 @@ seastar::future<> Client::reopen_session(int rank)
   pending_conns.reserve(mons.size());
   return seastar::parallel_for_each(mons, [this](auto rank) {
 #warning fixme
-    auto peer = monmap.get_addrs(rank).front();
+    auto peer = [&] {
+      auto& mon_addrs = monmap.get_addrs(rank);
+      if (msgr.get_myaddr().is_legacy()) {
+        return mon_addrs.legacy_addr();
+      } else {
+        return mon_addrs.msgr2_addr();
+      }
+    }();
+    if (peer == entity_addr_t{}) {
+      // crimson msgr only uses the first bound addr
+      logger().warn("mon.{} does not have an addr compatible with me", rank);
+      return seastar::now();
+    }
     logger().info("connecting to mon.{}", rank);
     return seastar::futurize_invoke(
         [peer, this] () -> seastar::future<Connection::AuthResult> {