From c078c810313ece647db6d9056c0eca5256a91a34 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 20 Dec 2018 10:57:44 -0600 Subject: [PATCH] mon/MonMap: no noname- mon name prefix when for_mkfs 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 --- src/mon/MonMap.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 3a02c004cc7..eb57c655128 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -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("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 << "'" -- 2.39.5