From: Sage Weil Date: Thu, 20 Dec 2018 16:57:44 +0000 (-0600) Subject: mon/MonMap: no noname- mon name prefix when for_mkfs X-Git-Tag: v14.1.0~484^2~30 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c078c810313ece647db6d9056c0eca5256a91a34;p=ceph.git 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 --- diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 3a02c004cc7e..eb57c6551284 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 << "'"