From: Joao Eduardo Luis Date: Thu, 10 Apr 2014 14:14:19 +0000 (+0100) Subject: mon: Monitor: suicide on start if mon has been removed from monmap X-Git-Tag: v0.67.10~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=935e75a850b3363536cc09b68f45f2a497da4bb4;p=ceph.git mon: Monitor: suicide on start if mon has been removed from monmap If the monitor has been marked as having been part of an existing quorum and is no longer in the monmap, then it is safe to assume the monitor was removed from the monmap. In that event, do not allow the monitor to start, as it will try to find its way into the quorum again (and someone clearly stated they don't really want them there), unless 'mon force quorum join' is specified. Fixes: 6789 Backport: dumpling, emperor Signed-off-by: Joao Eduardo Luis (cherry picked from commit 86b85947a2148c2e73886c1a7edd09093966ada0) Conflicts: src/common/config_opts.h --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 16ce09819c6d..31905358df3d 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -203,6 +203,7 @@ OPTION(mon_leveldb_max_open_files, OPT_INT, 0) // monitor's leveldb max open fil OPTION(mon_leveldb_compression, OPT_BOOL, false) // monitor's leveldb uses compression OPTION(mon_leveldb_paranoid, OPT_BOOL, false) // monitor's leveldb paranoid flag OPTION(mon_leveldb_log, OPT_STR, "") +OPTION(mon_force_quorum_join, OPT_BOOL, false) // force monitor to join quorum even if it has been previously removed from the map OPTION(paxos_stash_full_interval, OPT_INT, 25) // how often (in commits) to stash a full copy of the PaxosService state OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0) // gather updates for this long before proposing a map update diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index eedb95bbb44b..6caef7996a1b 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -415,6 +415,16 @@ int Monitor::preinit() dout(10) << " monmap is " << *monmap << dendl; dout(10) << " extra probe peers " << extra_probe_peers << dendl; } + } else if (!monmap->contains(name)) { + derr << "not in monmap and have been in a quorum before; " + << "must have been removed" << dendl; + if (g_conf->mon_force_quorum_join) { + dout(0) << "we should have died but " + << "'mon_force_quorum_join' is set -- allowing boot" << dendl; + } else { + derr << "commit suicide!" << dendl; + return -ENOENT; + } } {