]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: allow mons to rename themselves with the join message
authorSage Weil <sage@newdream.net>
Mon, 21 May 2012 20:01:49 +0000 (13:01 -0700)
committerSage Weil <sage@newdream.net>
Mon, 21 May 2012 20:01:49 +0000 (13:01 -0700)
This allows mons that got stuck in the initial quorum's monmap as noname-*
to fix their name before joining in.

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

index c612ca64fcecd3bc98904e62a9e496b00b554a5b..1b7dd2736d93a735f015ec5cde0ffe66008b3e9d 100644 (file)
@@ -341,7 +341,7 @@ bool MonmapMonitor::preprocess_join(MMonJoin *join)
     join->put();
     return true;
   }
-  if (pending_map.contains(join->addr)) {
+  if (pending_map.contains(join->addr) && pending_map.get_name(join->addr) == join->name) {
     dout(10) << " already have " << join->addr << dendl;
     join->put();
     return true;
@@ -353,6 +353,8 @@ bool MonmapMonitor::prepare_join(MMonJoin *join)
   dout(0) << "adding/updating " << join->name << " at " << join->addr << " to monitor cluster" << dendl;
   if (pending_map.contains(join->name))
     pending_map.remove(join->name);
+  if (pending_map.contains(join->addr))
+    pending_map.remove(pending_map.get_name(join->addr));
   pending_map.add(join->name, join->addr);
   pending_map.last_changed = ceph_clock_now(g_ceph_context);
   join->put();