@@ -478,10 +478,11 @@ int validate_snapshot_name(at::ArgumentModifier mod,
478478int 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