From 3b43e2a7b02cafb043bb4b56babe55966780f983 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 21 Dec 2018 15:55:56 -0600 Subject: [PATCH] crimson: fix monmap build for seastar Signed-off-by: Sage Weil --- src/crimson/mon/MonClient.cc | 3 ++- src/mon/MonMap.cc | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 0ba52e16f9e3b..a4d35296bd828 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -496,7 +496,8 @@ seastar::future<> Client::reopen_session(int rank) } pending_conns.reserve(mons.size()); return seastar::parallel_for_each(mons, [this](auto rank) { - auto peer = monmap.get_addr(rank); +#warning fixme + auto peer = monmap.get_addrs(rank).legacy_addr(); logger().info("connecting to mon.{}", rank); auto conn = msgr.connect(peer, CEPH_ENTITY_TYPE_MON); auto& mc = pending_conns.emplace_back(conn, &keyring); diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index eb57c65512846..53bc8fc4953f6 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -424,7 +424,10 @@ int MonMap::init_with_ips(const std::string& ips, char n[2]; n[0] = 'a' + i; n[1] = 0; - string name = prefix; + string name; + if (!for_mkfs) { + name = prefix; + } name += n; _add_ambiguous_addr(name, addrs[i], 0); } @@ -645,11 +648,11 @@ seastar::future<> MonMap::build_monmap(const ceph::common::ConfigProxy& conf, // -m foo? if (const auto mon_host = conf.get_val("mon_host"); !mon_host.empty()) { - if (auto ret = init_with_ips(mon_host, "noname-"); ret == 0) { + if (auto ret = init_with_ips(mon_host, for_mkfs, "noname-"); ret == 0) { return make_ready_future<>(); } // TODO: resolve_addrs() is a blocking call - if (auto ret = init_with_hosts(mon_host, "noname-"); ret == 0) { + if (auto ret = init_with_hosts(mon_host, for_mkfs, "noname-"); ret == 0) { return make_ready_future<>(); } else { throw std::runtime_error(cpp_strerror(ret)); @@ -666,7 +669,7 @@ seastar::future<> MonMap::build_monmap(const ceph::common::ConfigProxy& conf, } // no info found from conf options lets try use DNS SRV records const string srv_name = conf.get_val("mon_dns_srv_name"); - return init_with_dns_srv(srv_name).then([this] { + return init_with_dns_srv(for_mkfs, srv_name).then([this] { if (size() == 0) { throw std::runtime_error("no monitors specified to connect to."); } @@ -759,9 +762,9 @@ int MonMap::build_initial(CephContext *cct, bool for_mkfs, ostream& errout) !mon_host.empty()) { // NOTE: the for_mkfs path here is dodgey.. it assumes the mons will be // named 'a', 'b', 'c'. - auto ret = init_with_ips(mon_host, for_mkfs, for_mkfs ? "" : "noname-"); + auto ret = init_with_ips(mon_host, for_mkfs, "noname-"); if (ret == -EINVAL) { - ret = init_with_hosts(mon_host, for_mkfs, for_mkfs ? "" : "noname-"); + ret = init_with_hosts(mon_host, for_mkfs, "noname-"); } if (ret < 0) { errout << "unable to parse addrs in '" << mon_host << "'" -- 2.39.5