From 7e6be86785465aecbbeb155548d3aa07c7271b76 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 16 May 2012 21:09:58 -0700 Subject: [PATCH] mon: discover peer names during probe Fill in noname- entires in initial generate monmap (e.g., from mon_host) with real peer names as we discover them. This will make the upcoming initial quorum config check work by letting us identify peers by name. Signed-off-by: Sage Weil --- src/mon/MonMap.h | 7 +++++++ src/mon/Monitor.cc | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/mon/MonMap.h b/src/mon/MonMap.h index f294b497145e6..f9706fd665b51 100644 --- a/src/mon/MonMap.h +++ b/src/mon/MonMap.h @@ -120,6 +120,13 @@ class MonMap { assert(n < rank_name.size()); return rank_name[n]; } + string get_name(entity_addr_t a) const { + map::const_iterator p = addr_name.find(a); + if (p == addr_name.end()) + return string(); + else + return p->second; + } int get_rank(const string& n) { for (unsigned i=0; iget_name(m->get_source_addr()); + if (peer_name.find("noname-") == 0) { + dout(10) << " renaming peer " << m->get_source_addr() << " " + << peer_name << " -> " << m->name << " in my monmap" + << dendl; + monmap->rename(peer_name, m->name); + } + // is there an existing quorum? if (m->quorum.size()) { dout(10) << " existing quorum " << m->quorum << dendl; -- 2.39.5