osdmap: add NOUP, NODOWN, NOIN, NOOUT flags

These prevent OSDs from being marked up, down, in, or out, respectively.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
mon: 'osd {set,unset} {noin,noout,noup,nodown}'

Move the set/unset flag code into a helper, and also use that for the
pause/unpause commands.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
mon: prevent osd from booting if NOUP

Do not add an osd attempting to boot to the map if NOUP is sent.  Instead,
send it the latest osdmap so it knows that it's not allowed to boot.

Signed-off-by: Sage Weil <sage@newdream.net>
osd: do not attempt to boot if NOUP

If NOUP is set, do not send the boot message.

We already send onetime subscriptions to the osdmap, so we will find out
about osdmap flag changes.  If it is cleared later, we'll pass into
start_boot() and _got_boot_version() again and send it then.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: prevent osd mark-down with NODOWN flag

If the NODOWN osdmap flag is set,

 - ignore osd failure reports
 - do not mark osds down due to lack of osd/pg stats

We *do* still allow explicit admin 'ceph osd down N' commands, and a
booting OSD to mark the previous instance of itself down.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: always remove booting osds from down_pending_out

The down_pending_out tracks OSDs that are down that we may want to
auto-mark out.  If an osd boots, it should be removed from this list
because it is no longer down; it doesn't matter whether it is marked in
or not.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: do not mark booting osds in if NOIN flag is set

If the NOIN osdmap flag is set, do not mark booting osds in.  Normally
we would for a range of reasons (always, new, auto-marked-out), but block
them all.

Do not limit manual 'ceph osd in N' commands.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: do not mark osds out if NOOUT flag is set

Do not mark down osds out when NOOUT flag is set.  This is more or less
equivalent to setting a very long 'mon osd down out interval', but
reversible and less annoying.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: use can_mark_*() helpers

So we can generalize beyond NO* flags.  We'll soon be adding other reasons
to not mark things up/down/in/out.  This lets us keep all though checks in
one place.

The helper methods will tell us why we can't do the thing (e.g., "NODOWN
flag is set").  The callers will generally tell us exactly what didn't
happen (e.g., "failure report of X ignored").

Signed-off-by: Sage Weil <sage@newdream.net>
mon: add 'mon osd min up ratio' and 'mon osd min in ratio'

Prevent the monitor from marking osds down or out when too many are already
in that state.  At this point the cluster is already broken and there is
little point in continuing to mark things down/out.

Setting these to 0 obviously disables the feature (by setting a minimum
of 0).

Signed-off-by: Sage Weil <sage@newdream.net>
mon: 'osd thrash <num epochs>'

Thrash the osdmap for N iterations.  Randomly mark OSDs up, down, in, out,
and up_thru in order to generate a difficult osdmap history for peering
to chew through.

Signed-off-by: Sage Weil <sage@newdream.net>
debian: don't strip HACK
mon: thrash pg_temp mapping, too

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: uninline a bunch of stuff

This will conflict with wip-lpg, yay.

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: use shared_ptr for addrs, addr vectors

We share a lot of identical addresses between map versions because they
don't tend to change very often.  Instead of having a separate copy for
every map, use shared_ptr and share references.  Also use a reference for
the entire addr vector(s) in case no addrs differ at all.

Create new encode/decode macros for vector< shared_ptr<T> >.

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: dedup addrs and addr vectors between maps

Compare two maps.  If an addrs matches, share the reference.  If all
addrs match, share the entire vector.

This leads to roughly 70% drop in memory utilization for the set of
thrashed maps I'm working with.

Signed-off-by: Sage Weil <sage@newdream.net>
osdmaptool: kludge to load a range of maps into memory

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: make dedup more forgiving, less assertive

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: use shared_ptr for CrushWrapper

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: dedup crush map

If the encoded crush map is identical between two versions, share the
reference.

Signed-off-by: Sage Weil <sage@newdream.net>