Previously, read_key was printing out error messages when it failed.
But because some callers are fine with it failing on ENOENT, and they
all have more context anyway, it no longer does so and they need
their own logging output. Now they have it.
Signed-off-by: Greg Farnum <greg@inktank.com>
Users can now place shared or exclusive locks, can remove their own
locks, can break the locks of others, and can list locks. All these
functions are considered PUBLIC_EXEC to match the other rbd methods.
Signed-off-by: Greg Farnum <greg@inktank.com>
The actual data object ids don't need to be artificially restricted in
length. RBD_MAX_BLOCK_NAME_SIZE just limits the size of the object
prefix, since it's used in rbd_info_t.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
The input values are stored as-is, and any values read are dumped in
hex. Rename listomap to listomapkeys to distinguish from
listomapvalues. Also add it to the man page.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
No features exist right now, so there are no extra options for them.
The old format is still used by default, and since the default will
change with layering, --new-format will be removed at that point and is
intentionally left undocumented.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This will fail if features are requested that the client or server
does not support. Currently there are no features defined, so
zero is the only valid value.
copy() preserves the format and features of the source image.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This is more convenient when you're creating daemons, since you want to
write out a keyring file for them. This lets you do it in a single
command.
Signed-off-by: Sage Weil <sage@inktank.com>
The value must be passed, and it shouldn't be below 4k
(enforced by the command line tool already) or above the
range expressible in the header.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Instead of interpreting the header, just copy all the data and
omap values from the original header to the newly name one.
This will continue working with future header changes.
We can create the new header and write all data and omap values
to it atomically to avoid some races.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Use the old or new methods make resize, snapshot add and snapsnhot
remove work with both old and new formats.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Make most of them take the parameters they actually use.
trim_image() now takes an ImageCtx, which means remove() must
open the image. This has the nice side effect of not duplicating
the snapshot listing code for the old format.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Checking that it exists doesn't prevent you from having the snapshot
change out from under you in the following situation:
You have the image open at snapshot "foo".
Someone removes snapshot "foo", writes some data to the image, and
creates a new snapshot called "foo".
This second snapshot will have a different id, but nothing prevents it
from having the name of a previously deleted snapshot.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
It now sets the member variables of ImageCtx so other functions
don't have to use the on-disk header. If the features use by
the new format are incompatible with this client, an error is returned.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Detect the format when an image is opened by the presence of the
original format header object. Use member variables of ImageCtx to
store image metadata instead of the on-disk header format
ImageCtx::header.
This lays the foundation for changing the rest of librbd to work with
old and new formats.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Add the client side (cls_rbd_client) for testing as well.
librbd will use the functions in cls_rbd_client to interact with cls_rbd.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
These will be useful in the new rbd header format. This brings the
API into parity with the available OSD ops for omaps.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
The osd ops and the librados methods all distinguish between keys
and values. It's useful to be able to read a bunch of keys without
fetching the values sometimes too.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Add a logging level parameter to CLS_LOG, and a CLS_ERR that's
analagous to derr.
For now cls_rgw is all logging at level 1, preserving existing
behavior. I'm more familiar with cls_rbd, so I changed those
logging levels.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This is dangerous, make sure they know what they're doing. I bet <someone>
$1 that Greg asked me to do this originally.
Signed-off-by: Sage Weil <sage@inktank.com>
Lines like
tunable <name> <value>
will adjust tunables. Right now only three are defined.
--enable-unsafe-tunables is required.
Signed-off-by: Sage Weil <sage@inktank.com>