]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rbd: set RBD_IMAGE_OPTION_FEATURES_CLEAR when --image-shared specified.
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Tue, 21 Jun 2016 08:48:27 +0000 (04:48 -0400)
committerDongsheng Yang <dongsheng.yang@easystack.cn>
Fri, 22 Jul 2016 11:04:09 +0000 (07:04 -0400)
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
src/tools/rbd/Utils.cc

index 53a30d380e10d5ce442b35c5e8ffc143a814cc13..89b437e0c02194e5153a5e26aed72ff732b20d04 100644 (file)
@@ -422,9 +422,12 @@ 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, features = 0, stripe_unit, stripe_count, object_size;
+  uint64_t order = 0, stripe_unit = 0, stripe_count = 0, object_size = 0;
+  uint64_t features = 0, features_clear = 0, features_set = 0;
   bool order_specified = true;
   bool features_specified = false;
+  bool features_clear_specified = false;
+  bool features_set_specified = false;
   bool stripe_specified = false;
 
   if (vm.count(at::IMAGE_ORDER)) {
@@ -454,8 +457,12 @@ int get_image_options(const boost::program_options::variables_map &vm,
   }
 
   if (vm.count(at::IMAGE_SHARED) && vm[at::IMAGE_SHARED].as<bool>()) {
-    features &= ~RBD_FEATURES_SINGLE_CLIENT;
-    features_specified = true;
+    if (features_specified) {
+      features &= ~RBD_FEATURES_SINGLE_CLIENT;
+    } else {
+      features_clear |= RBD_FEATURES_SINGLE_CLIENT;
+      features_clear_specified = true;
+    }
   }
 
   if (get_format) {
@@ -506,6 +513,11 @@ 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_clear_specified) {
+    opts->set(RBD_IMAGE_OPTION_FEATURES_CLEAR, features_clear);
+  }
+  if (features_set_specified)
+    opts->set(RBD_IMAGE_OPTION_FEATURES_SET, features_set);
   if (stripe_specified) {
     opts->set(RBD_IMAGE_OPTION_STRIPE_UNIT, stripe_unit);
     opts->set(RBD_IMAGE_OPTION_STRIPE_COUNT, stripe_count);