Skip to content

Commit bec46e9

Browse files
committed
rbd: set journaling feature when --mirror-image-mode is journal
Fixes: http://tracker.ceph.com/issues/58683 Signed-off-by: Chanyoung Park <[email protected]>
1 parent 08cec69 commit bec46e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/tools/rbd/Utils.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,11 @@ int validate_snapshot_name(at::ArgumentModifier mod,
478478
int get_image_options(const boost::program_options::variables_map &vm,
479479
bool get_format, librbd::ImageOptions *opts) {
480480
uint64_t order = 0, stripe_unit = 0, stripe_count = 0, object_size = 0;
481-
uint64_t features = 0, features_clear = 0;
481+
uint64_t features = 0, features_set = 0, features_clear = 0;
482482
std::string data_pool;
483483
bool order_specified = true;
484484
bool features_specified = false;
485+
bool features_set_specified = false;
485486
bool features_clear_specified = false;
486487
bool stripe_specified = false;
487488

@@ -509,6 +510,13 @@ int get_image_options(const boost::program_options::variables_map &vm,
509510
stripe_specified = true;
510511
}
511512

513+
if (vm.count(at::IMAGE_MIRROR_IMAGE_MODE) &&
514+
vm[at::IMAGE_MIRROR_IMAGE_MODE].as<librbd::mirror_image_mode_t>() ==
515+
RBD_MIRROR_IMAGE_MODE_JOURNAL) {
516+
features_set |= (RBD_FEATURE_EXCLUSIVE_LOCK | RBD_FEATURE_JOURNALING);
517+
features_set_specified = true;
518+
}
519+
512520
if (vm.count(at::IMAGE_SHARED) && vm[at::IMAGE_SHARED].as<bool>()) {
513521
if (features_specified) {
514522
features &= ~RBD_FEATURES_SINGLE_CLIENT;
@@ -581,6 +589,8 @@ int get_image_options(const boost::program_options::variables_map &vm,
581589
opts->set(RBD_IMAGE_OPTION_ORDER, order);
582590
if (features_specified)
583591
opts->set(RBD_IMAGE_OPTION_FEATURES, features);
592+
if (features_set_specified)
593+
opts->set(RBD_IMAGE_OPTION_FEATURES_SET, features_set);
584594
if (features_clear_specified) {
585595
opts->set(RBD_IMAGE_OPTION_FEATURES_CLEAR, features_clear);
586596
}

0 commit comments

Comments
 (0)