From: Dongsheng Yang Date: Tue, 21 Jun 2016 08:48:27 +0000 (-0400) Subject: tools/rbd: set RBD_IMAGE_OPTION_FEATURES_CLEAR when --image-shared specified. X-Git-Tag: ses5-milestone5~281^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3508f400374394ea81838a02b9efd36b6c3abaed;p=ceph.git tools/rbd: set RBD_IMAGE_OPTION_FEATURES_CLEAR when --image-shared specified. Signed-off-by: Dongsheng Yang --- diff --git a/src/tools/rbd/Utils.cc b/src/tools/rbd/Utils.cc index 53a30d380e10..89b437e0c021 100644 --- a/src/tools/rbd/Utils.cc +++ b/src/tools/rbd/Utils.cc @@ -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()) { - 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);