From d173c7bfeb3395a104eb1628a89fb8a5d60c3cdb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 23 May 2012 10:39:48 -0700 Subject: [PATCH] monmap: avoid dup addrs in generated initial monmap We were getting a dup addr from -m and ceph.conf. Prefer the ceph.conf name in this case. Also check for dup names here just to be thorough (even though I don't think that can come up currently). Fixes: #2464 Signed-off-by: Sage Weil --- src/mon/MonMap.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 22effb5f4b5..4a112a5557a 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -305,7 +305,14 @@ int MonMap::build_initial(CephContext *cct, ostream& errout) continue; } if (addr.get_port() == 0) - addr.set_port(CEPH_MON_PORT); + addr.set_port(CEPH_MON_PORT); + + // the make sure this mon isn't already in the map + if (contains(addr)) + remove(get_name(addr)); + if (contains(*m)) + remove(*m); + add(m->c_str(), addr); } -- 2.47.3