]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monmap, crimson: add support for the mon_host_override configurable.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 26 Aug 2021 17:17:14 +0000 (17:17 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 30 Aug 2021 11:29:02 +0000 (11:29 +0000)
NOTE: crimson still misses the `CephContext::get_mon_addrs()` support.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/mon/MonMap.cc

index d45c039beebe4104c8966bc4210a6c5358e48899..06ce6af28238124e218c0904f21ee29f8a1fecaf 100644 (file)
@@ -823,6 +823,20 @@ seastar::future<> MonMap::build_monmap(const crimson::common::ConfigProxy& conf,
 
 seastar::future<> MonMap::build_initial(const crimson::common::ConfigProxy& conf, bool for_mkfs)
 {
+  // mon_host_override?
+  if (auto mon_host_override = conf.get_val<std::string>("mon_host_override");
+      !mon_host_override.empty()) {
+    if (auto ret = init_with_ips(mon_host_override, for_mkfs, "noname-"); ret == 0) {
+      return make_ready_future<>();
+    }
+    // TODO: resolve_addrs() is a blocking call
+    if (auto ret = init_with_hosts(mon_host_override, for_mkfs, "noname-"); ret == 0) {
+      return make_ready_future<>();
+    } else {
+      throw std::runtime_error(cpp_strerror(ret));
+    }
+  }
+
   // file?
   if (const auto monmap = conf.get_val<std::string>("monmap");
       !monmap.empty()) {