summaryrefslogtreecommitdiffstats
path: root/src/tools/rbd/Utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rbd/Utils.cc')
-rw-r--r--src/tools/rbd/Utils.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/rbd/Utils.cc b/src/tools/rbd/Utils.cc
index 71da0bd274a..95c8725aa33 100644
--- a/src/tools/rbd/Utils.cc
+++ b/src/tools/rbd/Utils.cc
@@ -478,10 +478,11 @@ int validate_snapshot_name(at::ArgumentModifier mod,
int get_image_options(const boost::program_options::variables_map &vm,
bool get_format, librbd::ImageOptions *opts) {
uint64_t order = 0, stripe_unit = 0, stripe_count = 0, object_size = 0;
- uint64_t features = 0, features_clear = 0;
+ uint64_t features = 0, features_set = 0, features_clear = 0;
std::string data_pool;
bool order_specified = true;
bool features_specified = false;
+ bool features_set_specified = false;
bool features_clear_specified = false;
bool stripe_specified = false;
@@ -509,6 +510,13 @@ int get_image_options(const boost::program_options::variables_map &vm,
stripe_specified = true;
}
+ if (vm.count(at::IMAGE_MIRROR_IMAGE_MODE) &&
+ vm[at::IMAGE_MIRROR_IMAGE_MODE].as<librbd::mirror_image_mode_t>() ==
+ RBD_MIRROR_IMAGE_MODE_JOURNAL) {
+ features_set |= (RBD_FEATURE_EXCLUSIVE_LOCK | RBD_FEATURE_JOURNALING);
+ features_set_specified = true;
+ }
+
if (vm.count(at::IMAGE_SHARED) && vm[at::IMAGE_SHARED].as<bool>()) {
if (features_specified) {
features &= ~RBD_FEATURES_SINGLE_CLIENT;
@@ -581,6 +589,8 @@ int get_image_options(const boost::program_options::variables_map &vm,
opts->set(RBD_IMAGE_OPTION_ORDER, order);
if (features_specified)
opts->set(RBD_IMAGE_OPTION_FEATURES, features);
+ if (features_set_specified)
+ opts->set(RBD_IMAGE_OPTION_FEATURES_SET, features_set);
if (features_clear_specified) {
opts->set(RBD_IMAGE_OPTION_FEATURES_CLEAR, features_clear);
}