cls_rbd: fix signed-ness warning

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
objclass: remove unused variable from cls_cxx_map_get_vals

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
cls_rbd: add {get,set}_id methods

These will be used on a new rbd id object to provide a level of
indirection so that header objects don't need to move when
an image is renamed.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: add indirection between name and header object

This adds a new rbd_id.$name object that contains the id of an image.
Rename the header in new-format images to  rbd_header.$id, so that
it doesn't need to change when an image is renamed - the rbd_id.$name
object is copied to a new object instead.

With layering, this becomes more important because many child images
could be depending on the header object of a parent image.

This is another change to the new format, but since no one uses it yet,
we don't need to worry about backwards compatibility.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
cls_rbd: use already defined local var instead of constant

This occurrence was meant to be replaced in the original commit.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
objclass: add create method

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
cls_rbd: add methods for dealing with rbd_directory objects

These hide the structure of the directory from clients, and provide
mappings from id to name and name to id. These mappings aren't needed
for old format images, but with layering, they're useful to show
the user e.g. the name of an image's parent instead of its id.

This also makes the directory more efficient for new-style images, since
it uses omap instead of tmap.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
librbd: handle NULL old_format pointer in detect_format()'s logging

Signed-off-by: Dan Mick <dan.mick@inktank.com>
librbd: use new class methods to access rbd_directory

Since we only use the new interface with new format images,
old clients won't be able to list them.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa: add rbd command rename tests

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa: restructure rbd cli tests

Move tests into functions and remove all images at the end of each.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa: add tests for rbd ls with old and new formats

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa: run rbd tests against old and new formats

Now it's not the caller's responsibility to specify the format,
and we can eliminate a job from the qa suite.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
cls_rbd_client: check return code of operate

This lets us get a more useful error, like -ENOENT, instead
of a failure to decode the empty output buffer.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
qa: add rbd remove tests

These check that removing an image still works if an rbd rm
command was interrupted partway through.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
OSD,PG::scrub() move pg->put() into queue process

This clarifies ownership of the pg reference.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: CephPeeringEvt

CephPeeringEvt is now the supertype for all peering state machine
events.  This will allow us to generalize checking for stale peering
events and delaying events for future maps.

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: Move handle_* methods to PG

PG now calls handle_event in RecoveryState.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: Remove handle_pg_missing, MOSDPGMissing no longer used

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
OSD,PG: push message checking to pg

old_peering_evt now checks CephPeeringEvts generically in
PG::handle_peering_event().

Signed-off-by: Samuel Just <sam.just@inktank.com>