]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonMap: no noname- mon name prefix when for_mkfs
authorSage Weil <sage@redhat.com>
Thu, 20 Dec 2018 16:57:44 +0000 (10:57 -0600)
committerSage Weil <sage@redhat.com>
Thu, 3 Jan 2019 17:17:31 +0000 (11:17 -0600)
Teuthology no longer puts mon addr in ceph.conf, and instead sets the
mon_host option globally.  That means a different path for
ceph-monstore-tool rebuild to regenerate the monmap, and the generated
map's names need to match teuthologies.

This change fixes the teuthology rebuild test because that tests's mon
names happen to also be 'a', 'b', 'c'.  It's fragile, but it works.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonMap.cc

index 3a02c004cc7e6b9a18818593c1ffb6863fb7b1d9..eb57c65512846ac330af95035800264cb2625f79 100644 (file)
@@ -757,9 +757,11 @@ int MonMap::build_initial(CephContext *cct, bool for_mkfs, ostream& errout)
   // -m foo?
   if (const auto mon_host = conf.get_val<std::string>("mon_host");
       !mon_host.empty()) {
-    auto ret = init_with_ips(mon_host, for_mkfs, "noname-");
+    // 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-");
     if (ret == -EINVAL) {
-      ret = init_with_hosts(mon_host, for_mkfs, "noname-");
+      ret = init_with_hosts(mon_host, for_mkfs, for_mkfs ? "" : "noname-");
     }
     if (ret < 0) {
       errout << "unable to parse addrs in '" << mon_host << "'"