monclient: name resolved mon hosts noname-* too

This would allow you to do

  mon host = foo, bar, baz

or

  mon host = multiarecordhostname.foo.com

and have the generated monmap tag monitors as noname-, so that the ceph-mon
mkfs will identify itself as one of them and initialize itself
properly.

Signed-off-by: Sage Weil <sage@newdream.net>
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 <sage@inktank.com>
mon: add initial quorum config options

Signed-off-by: Sage Weil <sage@inktank.com>
mon: clean up "joined" flag

- check flag on init, keep in memory
- set flag only when we are active and have a committed monmap.  i.e., when
  we are active participants in a bootstrapped/created mon cluster.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: pass has_ever_joined in probe messages

This will allow monitors to behave appropriately with that important info..

Signed-off-by: Sage Weil <sage@inktank.com>
monmaptool: don't increment epoch on modification

This just confuses things, because a manually manipulated map might have
some epoch number that bears no relation to the actual published/committed
maps.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: take probed peer's monmap if it has ever joined a quorum

If we probe a peer and their monmap has actually been part of a started
cluster/quorum, and ours hasn't, take theirs.  Comparing versions isn't
sufficient.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: use current monmap for initial quorum

This makes a bit more sense.  Don't use the seed monmap, but use the one
we ended up with when we formed our first quorum.  This will do a better
job of picking up names of peers, and also ensure we get a map based on
the mon initial members (if specified).

Signed-off-by: Sage Weil <sage@inktank.com>
mon: add set of additional peers to probe

Probe an additional set of peers, not included in the monmap.

Incomplete; we'll still assume they *can* form a quorum.  See next patch.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: only include monmap mon's in outside_quorum, new quorum

Only include mons that are in the monmap in the outside_quorum set, which
we use to determine if we can form a new quorum.

In particular, if we ourselves are not in the monmap, we can't call an
election (that wouldn't include us anyway).

Signed-off-by: Sage Weil <sage@inktank.com>
mon: limit initial quorum to mon_initial_members

This is a two-stage process.

 * If we start up, and have never joined a quorum, and initial members are
   specified, only include them in the monmap; put all others in the
   extra probe list.
 * We add missing members if necessary to make the monmap (and initial
   quorum) the right size.
 * If we probe someone that *has* participated in a successful quorum, we
   get their monmap, and restart, so this is moot.
 * We only call an election to create a new cluster if outside_quorum gets
   big enough (it will only include initial members) and if it includes us.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: include quorum member names in 'mon stat'

Signed-off-by: Sage Weil <sage@inktank.com>
mon: ignore election messages from outside monmap

These shouldn't(tm) happen with new code, but with old code they do.  And
if we get them, elector can try to monmap->get_inst() on them and crash.
Throw them out here; they're nonsense from our perspective anyway if the
peer isn't part of our monmap.

Signed-off-by: Sage Weil <sage@inktank.com>
qa: add a bunch of mon bootstrap tests

These's are comprehensive because a lot of the startup logic is about
picking a local address, and it's difficult to do test that on a single
host.  They cover the other variables surrounding mon bringing up, though:

 - part of initial monmap, or not
 - new nodes given all prior nodes, or not
 - new nodes have self included in monmap seed, or not
 - initial quorum members

Signed-off-by: Sage Weil <sage@inktank.com>
mon: clean up initial_members code slightly

Don't recalc rank unless we need to.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: drop mon_initial_hosts

Bad idea.

Signed-off-by: Sage Weil <sage@inktank.com>
monmap: move monmap generation from ip/host list into MonMap

Also generalize the prefix so it's explicit in the caller and a bit less
magic.

Signed-off-by: Sage Weil <sage@inktank.com>
admin_socket: match first word against command

This lets us do commands that take arguments.  We assume space is the
separator.

Signed-off-by: Sage Weil <sage@inktank.com>
cephtool: multiword admin socket commands

Slurp up anything on the command line that isn't an option, so that you can
do

 ceph --admin-socket /path/to/asok foo bar baz

instead of

 ceph --admin-socket /path/to/asok 'foo bar baz'

Signed-off-by: Sage Weil <sage@inktank.com>
mon: all starting with empty monmap

It's okay to start up with an empty monmap.  It just means that you must:

 * set 'mon initial members'
 * feed hints via the admin socket, or learn hints from other mons probing
   us

Signed-off-by: Sage Weil <sage@inktank.com>