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>
Allow URL-safe base64 cephx keys to be decoded.

In these cases + and / are replaced by - and _ to prevent problems when using
the base64 strings in URLs.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
Signed-off-by: Sage Weil <sage@inktank.com>
ceph.spec.in: add ceph-disk-{activate,prepare}

Reported-by: Jimmy Tang <jtang@tchpc.tcd.ie>
Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'origin/stable' into next
rados tool: copy object

New rados command: rados cp <src-obj> [dest-obj]

Requires specifying source pool. Target pool and locator can be specified.
The new command preserves object xattrs and omap data.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rados tool: copy entire pool

A new rados tool command that copies an entire pool
into another existing pool.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>