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>
mon: thrash pg_temp mapping, too

Signed-off-by: Sage Weil <sage@newdream.net>
mon: consider pending_inc in {up,in}_ratio for can_mark_{out,down}()

Consider pending changes when calculating the current up/in ratios.  Among
other things, this will make the marking of osds down->out stop once it
hits the min in ratio.

Signed-off-by: Sage Weil <sage@newdream.net>
mon: 'osd [un]set noin'

Missed this one.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Merge branch 'wip-mon'

Reviewed-by: Gregory Farnum <gregory.farnum@dreamhost.com>
fix file_layout.sh layouts test

preferred_osd is not gone.

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