]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: fix monmap build for seastar
authorSage Weil <sage@redhat.com>
Fri, 21 Dec 2018 21:55:56 +0000 (15:55 -0600)
committerSage Weil <sage@redhat.com>
Thu, 3 Jan 2019 17:17:31 +0000 (11:17 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crimson/mon/MonClient.cc
src/mon/MonMap.cc

index 0ba52e16f9e3b8b9415fee4f673ef52df0682a74..a4d35296bd82828ee34e286d8efbbbfedc21e15b 100644 (file)
@@ -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);
index eb57c65512846ac330af95035800264cb2625f79..53bc8fc4953f6eaadf8f3353ec353bcb21f98e69 100644 (file)
@@ -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<std::string>("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<std::string>("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 << "'"