OPTION(rbd_readahead_max_bytes, OPT_LONGLONG, 512 * 1024) // set to 0 to disable readahead
OPTION(rbd_readahead_disable_after_bytes, OPT_LONGLONG, 50 * 1024 * 1024) // how many bytes are read in total before readahead is disabled
OPTION(rbd_clone_copy_on_read, OPT_BOOL, false)
-OPTION(rbd_object_map, OPT_BOOL, false) // whether to enable the RBD object map
OPTION(rbd_blacklist_on_break_lock, OPT_BOOL, true) // whether to blacklist clients whose lock was broken
OPTION(rbd_blacklist_expire_seconds, OPT_INT, 0) // number of seconds to blacklist - set to 0 for OSD default
OPTION(rbd_default_order, OPT_INT, 22)
OPTION(rbd_default_stripe_count, OPT_U64, 0) // changing requires stripingv2 feature
OPTION(rbd_default_stripe_unit, OPT_U64, 0) // changing to non-object size requires stripingv2 feature
-OPTION(rbd_default_features, OPT_INT, 7) // only applies to format 2 images
+OPTION(rbd_default_features, OPT_INT, 3) // only applies to format 2 images
// +1 for layering, +2 for stripingv2,
// +4 for exclusive lock, +8 for object map
" (-l includes snapshots/clones)\n"
" info <image-name> show information about image size,\n"
" striping, etc.\n"
-" create [--order <bits>] [--image-shared] --size <MB> <name>\n"
-" create an empty image\n"
-" clone [--order <bits>] [--image-shared] <parentsnap> <clonename>\n"
-" clone a snapshot into a COW\n"
+" create [--order <bits>] [--image-features <features>] [--image-shared]\n"
+" --size <MB> <name> create an empty image\n"
+" clone [--order <bits>] [--image-features <features>] [--image-shared]\n"
+" <parentsnap> <clonename> clone a snapshot into a COW\n"
" child image\n"
" children <snap-name> display children of snapshot\n"
" flatten <image-name> fill clone with parent data\n"
" rm <image-name> delete an image\n"
" export <image-name> <path> export image to file\n"
" \"-\" for stdout\n"
-" import [--image-shared] <path> <image-name> import image from file\n"
-" (dest defaults\n"
-" as the filename part of file)\n"
-" \"-\" for stdin\n"
+" import [--image-features <features>] [--image-shared]\n"
+" <path> <image-name> import image from file (dest\n"
+" defaults as the filename part\n"
+" of file). \"-\" for stdin\n"
" diff <image-name> [--from-snap <snap-name>] print extents that differ since\n"
" a previous snap, or image creation\n"
" export-diff <image-name> [--from-snap <snap-name>] <path>\n"
" --image-format <format-number> format to use when creating an image\n"
" format 1 is the original format (default)\n"
" format 2 supports cloning\n"
+" --image-features <features> optional format 2 features to enable\n"
+" +1 layering support, +2 striping v2,\n"
+" +4 exclusive lock, +8 object map\n"
" --image-shared image will be used concurrently (disables\n"
" RBD exclusive lock and dependent features)\n"
" --id <username> rados user (without 'client.'prefix) to\n"
}
r = rbd.create(io_ctx, imgname, size, order);
} else {
- if (features == 0) {
- features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK;
- }
- if (g_conf->rbd_object_map) {
- features |= RBD_FEATURE_OBJECT_MAP;
- }
if ((stripe_unit || stripe_count) &&
(stripe_unit != (1ull << *order) && stripe_count != 1)) {
features |= RBD_FEATURE_STRIPINGV2;
+ } else {
+ features &= ~RBD_FEATURE_STRIPINGV2;
}
r = rbd.create3(io_ctx, imgname, size, features, order,
stripe_unit, stripe_count);
librados::IoCtx &c_ioctx, const char *c_name,
uint64_t features, int *c_order)
{
- if (features == 0) {
- features = (RBD_FEATURES_ALL & ~RBD_FEATURE_OBJECT_MAP);
- }
- else if ((features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) {
+ if ((features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) {
return -EINVAL;
}
- if (g_conf->rbd_object_map) {
- features |= RBD_FEATURE_OBJECT_MAP;
- }
return rbd.clone(p_ioctx, p_name, p_snapname, c_ioctx, c_name, features,
c_order);
bool format_specified = false,
output_format_specified = false;
int format = 1;
- uint64_t features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK;
+
+ uint64_t features = g_conf->rbd_default_features;
+ bool shared = false;
+
const char *imgname = NULL, *snapname = NULL, *destname = NULL,
*dest_poolname = NULL, *dest_snapname = NULL, *path = NULL,
*devpath = NULL, *lock_cookie = NULL, *lock_client = NULL,
progress = false;
} else if (ceph_argparse_flag(args, i , "--allow-shrink", (char *)NULL)) {
resize_allow_shrink = true;
+ } else if (ceph_argparse_flag(args, i, "--image-features", (char *)NULL)) {
+ features = strict_strtol(val.c_str(), 10, &parse_err);
+ if (!parse_err.empty()) {
+ cerr << "rbd: error parsing --image-features: " << parse_err
+ << std::endl;
+ return EXIT_FAILURE;
+ }
} else if (ceph_argparse_flag(args, i, "--image-shared", (char *)NULL)) {
- features &= ~(RBD_FEATURE_EXCLUSIVE_LOCK | RBD_FEATURE_OBJECT_MAP);
+ shared = true;
} else if (ceph_argparse_witharg(args, i, &val, "--format", (char *) NULL)) {
long long ret = strict_strtoll(val.c_str(), 10, &parse_err);
if (parse_err.empty()) {
}
}
+ if (shared) {
+ features &= ~(RBD_FEATURE_EXCLUSIVE_LOCK | RBD_FEATURE_OBJECT_MAP);
+ }
+ if (((features & RBD_FEATURE_EXCLUSIVE_LOCK) == 0) &&
+ ((features & RBD_FEATURE_OBJECT_MAP) != 0)) {
+ cerr << "rbd: exclusive lock image feature must be enabled to use "
+ << "the object map" << std::endl;
+ return EXIT_FAILURE;
+ }
+
common_init_finish(g_ceph_context);
i = args.begin();
(-l includes snapshots/clones)
info <image-name> show information about image size,
striping, etc.
- create [--order <bits>] [--image-shared] --size <MB> <name>
- create an empty image
- clone [--order <bits>] [--image-shared] <parentsnap> <clonename>
- clone a snapshot into a COW
+ create [--order <bits>] [--image-features <features>] [--image-shared]
+ --size <MB> <name> create an empty image
+ clone [--order <bits>] [--image-features <features>] [--image-shared]
+ <parentsnap> <clonename> clone a snapshot into a COW
child image
children <snap-name> display children of snapshot
flatten <image-name> fill clone with parent data
rm <image-name> delete an image
export <image-name> <path> export image to file
"-" for stdout
- import [--image-shared] <path> <image-name> import image from file
- (dest defaults
- as the filename part of file)
- "-" for stdin
+ import [--image-features <features>] [--image-shared]
+ <path> <image-name> import image from file (dest
+ defaults as the filename part
+ of file). "-" for stdin
diff <image-name> [--from-snap <snap-name>] print extents that differ since
a previous snap, or image creation
export-diff <image-name> [--from-snap <snap-name>] <path>
--image-format <format-number> format to use when creating an image
format 1 is the original format (default)
format 2 supports cloning
+ --image-features <features> optional format 2 features to enable
+ +1 layering support, +2 striping v2,
+ +4 exclusive lock, +8 object map
--image-shared image will be used concurrently (disables
RBD exclusive lock and dependent features)
--id <username> rados user (without 'client.'prefix) to