mon, osdmaptool: switch to primary-specifying pg_to_up_acting_osds

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add primary-specifying pg_to_acting_osds

This works the same as pg_to_up_acting_osds

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add primary out param to pg_to_raw_up, and use pointers instead of refs

The only user is in the OSDMonitor, and it's going to want that
information anyway.

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add a CEPH_FEATURE_OSDMAP_ENC feature, and use new encoding

Bring our OSDMap encoding into the modern Ceph world! :) This is
fairly straightforward, but has a few rough edges:
Previously we had a "struct_v" which went at the beginning of the
OSDMap encoding, and then later on an ev "extended version" which
was used to store the more-frequently-changed OSDMap pieces. There
was no size information stored explicitly to let clients skip this,
but osd maps were always encoded into their own bufferlist before
being sent to clients, which had the same effect.
We now use the modern ENCODE_START three times:
1) for the overall OSDMap encoding,
2) for the client-usable portion of the map,
3) for the "extended" portion of the map

This will let us independently rev everything, which may come in
useful if we want to (for instance) add a "monitor" portion to the
map that the OSDs don't care about. It also makes adding new
client information a lot easier since older clients will still
be able to decode the map as a whole.

We may want to merge this OSDMAP_ENC feature with one of the others
we are creating during this cycle, since they're all very closely
related. That will also let us protect more naturally against old
clients getting a map they need to understand but can't (because
we only need the new map features-to-come when used with erasure-encoded
PGs, etc).

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: update Incremental encode/decode to match the full map's

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add [new_]primary_temp to the map and Incremental

It's not used actively yet, but there it is.

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add primary_temp to apply_incremental()

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: dedup the primary_temp

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: expose the primary_temp in print()

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMonitor: remove primary_temp entries when you remove their pool

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMonitor: make remove_redundant_pg_temp clear primary, too

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMonitor: implement remove_down_primary_temp()

Same as remove_down_pg_temp()

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add primary out params to internal _pg_to_up_acting_osds function

And use pointers instead of references for out params.

Now pg_to_up_acting_osds and pg_to_acting_osds can plug in to this slightly
more real implementation, instead of making up their own. (We are still
just using the first member anyway, but we're about to plug it into
the bottom layer of functions.)

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: add primary out params to _pg_to_osds and _raw_to_up_osds

Switch to use pointers for the out parameters instead of references.

These functions are still just pointing at the front of the generated
lists for the "primary" params, but now that all their callers respect
these outputs we can add programmatic leader assignment with just these
two functions.

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: pay attention to the temp_primary in _get_temp_osds

Also, switch it to use pointers instead of references, and force callers
to check the out params instead of relying on a return code for if anything
was set (trying to use the return code when there are two possible outputs
does not provide useable semantics).

Signed-off-by: Greg Farnum <greg@inktank.com>
OSDMap: move temp manipulation functions out of OSDMonitor

Signed-off-by: Greg Farnum <greg@inktank.com>