reserve a few feature bits

Make sure we have a bit of warning before we reach the end times.

Signed-off-by: Sage Weil <sage@redhat.com>
mon: use pre-encoded OSDMap for build_latest_full() MOSDMap message

Do not reencode; use our existing encoded bufferlist.

Signed-off-by: Sage Weil <sage@redhat.com>
osd: warn if reencoding and OSDMap with fewer features than the mon

It is very dangerous to reencode and OSDMap with fewer features than the
mon intended as we may be introducing a different variation of the same
OSDMap epoch into the wild.  Add a build warning here as well as this is
a potentially serious problem.

Signed-off-by: Sage Weil <sage@redhat.com>
osd: use encoded osdmap bl instead of reencoding

We have a good one on disk; there is no reason to do this.

Signed-off-by: Sage Weil <sage@redhat.com>
prevent random people from encoding the OSDMap

This is a safety check: nobody should be encoding OSDMaps except:

 - the mons
 - MOSDMap, when encoding old OSDMaps with legacy encodings
 - ceph-dencoder
 - the OSD

More importantly, nobody should be encoding OSDMap::Incremental except

 - the leader mon

We use a reserved feature bit to indicate that the encoder is enlightened.
Note that we skip this check for legacy encodings, so we don't touch
MOSDMap in this patch.

Signed-off-by: Sage Weil <sage@redhat.com>
add MMonGetOSDMap message

This message lets you explicitly request a range of full or incremental
maps from someone (the monitor, presumably), independent of any other
session state.

Signed-off-by: Sage Weil <sage@redhat.com>
mon/OSDMonitor: handle MMonGetOSDMap

Respond to MMonGetOSDMap with an MOSDMap filled with what we have.

Signed-off-by: Sage Weil <sage@redhat.com>
buffer: add iterator::get_bl()

Signed-off-by: Sage Weil <sage@redhat.com>
osd/OSDMap: encode crc

Note that we include the logic in OSDMap::encode to add data that comes
after the crc, although we do not use it yet.

Also note that we do not yet verify the crc on decode.

Signed-off-by: Sage Weil <sage@redhat.com>
mon/OSDMonitor: populate Incremental::full_crc

When we encode an Incremental, put in the expected crc for the resulting
full OSDMap.

Signed-off-by: Sage Weil <sage@redhat.com>
osd/OSDMap: verify CRC on decode

Signed-off-by: Sage Weil <sage@redhat.com>
mon/OSDMonitor: verify full_crc when available

Crash if it is wrong.  The monitors should *always* agree.

Signed-off-by: Sage Weil <sage@redhat.com>
osd: verify our OSDMap encoding based on crc

When we generate a full map and can't replicate teh expected CRC, request
the full map from the mon.

Note that we should do everything we can to avoid doing this:

 - upgrade OSDs before mons
 - do not encode things into OSDMaps that OSDs can't replicate

Signed-off-by: Sage Weil <sage@redhat.com>
osd: add osd_inject_bad_map_crc_probability option

Signed-off-by: Sage Weil <sage@redhat.com>
osdmaptool: allow OSDMap encode

Signed-off-by: Sage Weil <sage@redhat.com>
ceph-dencoder: mark OSDMap as featureful, but with stray data

Signed-off-by: Sage Weil <sage@redhat.com>
mon/OSDMonitor: do not reencode OSDMap on 'osd getmap'

Return the bits unmolested.

This is a slight change in that we do not reencode based on the client's
features.  However, this is an admin command and the client is generally
the CLI or REST API.  It makes more sense to provide the unmolested
bits than to reencode them based on features present in a tool that
never inspects the map.

Signed-off-by: Sage Weil <sage@redhat.com>
mon/OSDMonitor: dump inc and full maps we get a crc mismatch

Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2300 from ceph/wip-osdmap

add osdmap checksums

    sage-2014-12-16_06:27:10-rados:singleton-wip-sage-testing2-distro-basic-multi
    sage-2014-12-15_13:18:23-rados:thrash-wip-sage-testing2-distro-basic-multi

Reviewed-by: Samuel Just <sjust@redhat.com>