From: Jason Dillaman Date: Fri, 5 Jan 2018 16:31:37 +0000 (-0500) Subject: rbd: hide implicit / non-mutable features from the CLI help X-Git-Tag: v13.0.2~531^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4ffd5b79073798bdf45799ffa074d79df402bd21;p=ceph.git rbd: hide implicit / non-mutable features from the CLI help The layering and data-pool features are enabled automatically when striping or a data pool is specified, respectively. For the 'rbd feature XYZ' command, hide all non-mutable features. Signed-off-by: Jason Dillaman --- diff --git a/src/include/rbd/features.h b/src/include/rbd/features.h index efdcf0e8e668..651fff8e5e78 100644 --- a/src/include/rbd/features.h +++ b/src/include/rbd/features.h @@ -64,4 +64,8 @@ RBD_FEATURE_FAST_DIFF | \ RBD_FEATURE_JOURNALING) +/// features that will be implicitly enabled +#define RBD_FEATURES_IMPLICIT_ENABLE (RBD_FEATURE_STRIPINGV2 | \ + RBD_FEATURE_DATA_POOL) + #endif diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t index 532c26ae0e06..3f5fdb5fd8c4 100644 --- a/src/test/cli/rbd/help.t +++ b/src/test/cli/rbd/help.t @@ -195,9 +195,8 @@ Skip test on FreeBSD as it generates different output there. --order arg object order [12 <= order <= 25] --object-size arg object size in B/K/M [4K <= object size <= 32M] --image-feature arg image features - [layering(+), striping, exclusive-lock(+*), - object-map(+*), fast-diff(+*), deep-flatten(+-), - journaling(*), data-pool] + [layering(+), exclusive-lock(+*), object-map(+*), + fast-diff(+*), deep-flatten(+-), journaling(*)] --image-shared shared image --stripe-unit arg stripe unit in B/K/M --stripe-count arg stripe count @@ -242,9 +241,9 @@ Skip test on FreeBSD as it generates different output there. --order arg object order [12 <= order <= 25] --object-size arg object size in B/K/M [4K <= object size <= 32M] --image-feature arg image features - [layering(+), striping, exclusive-lock(+*), + [layering(+), exclusive-lock(+*), object-map(+*), fast-diff(+*), deep-flatten(+-), - journaling(*), data-pool] + journaling(*)] --image-shared shared image --stripe-unit arg stripe unit in B/K/M --stripe-count arg stripe count @@ -287,9 +286,8 @@ Skip test on FreeBSD as it generates different output there. --order arg object order [12 <= order <= 25] --object-size arg object size in B/K/M [4K <= object size <= 32M] --image-feature arg image features - [layering(+), striping, exclusive-lock(+*), - object-map(+*), fast-diff(+*), deep-flatten(+-), - journaling(*), data-pool] + [layering(+), exclusive-lock(+*), object-map(+*), + fast-diff(+*), deep-flatten(+-), journaling(*)] --image-shared shared image --stripe-unit arg stripe unit in B/K/M --stripe-count arg stripe count @@ -400,8 +398,7 @@ Skip test on FreeBSD as it generates different output there. image specification (example: [/]) image features - [layering, striping, exclusive-lock, object-map, - fast-diff, deep-flatten, journaling, data-pool] + [exclusive-lock, object-map, fast-diff, journaling] Optional arguments -p [ --pool ] arg pool name @@ -420,8 +417,7 @@ Skip test on FreeBSD as it generates different output there. image specification (example: [/]) image features - [layering, striping, exclusive-lock, object-map, - fast-diff, deep-flatten, journaling, data-pool] + [exclusive-lock, object-map, fast-diff, journaling] Optional arguments -p [ --pool ] arg pool name @@ -685,9 +681,8 @@ Skip test on FreeBSD as it generates different output there. --order arg object order [12 <= order <= 25] --object-size arg object size in B/K/M [4K <= object size <= 32M] --image-feature arg image features - [layering(+), striping, exclusive-lock(+*), - object-map(+*), fast-diff(+*), deep-flatten(+-), - journaling(*), data-pool] + [layering(+), exclusive-lock(+*), object-map(+*), + fast-diff(+*), deep-flatten(+-), journaling(*)] --image-shared shared image --stripe-unit arg stripe unit in B/K/M --stripe-count arg stripe count diff --git a/src/tools/rbd/ArgumentTypes.cc b/src/tools/rbd/ArgumentTypes.cc index 13c31b7d8740..18a99daedf1b 100644 --- a/src/tools/rbd/ArgumentTypes.cc +++ b/src/tools/rbd/ArgumentTypes.cc @@ -366,6 +366,14 @@ std::string get_short_features_help(bool append_suffix) { bool first_feature = true; oss << "["; for (auto &pair : ImageFeatures::FEATURE_MAPPING) { + if ((pair.first & RBD_FEATURES_IMPLICIT_ENABLE) != 0ULL) { + // hide implicitly enabled features from list + continue; + } else if (!append_suffix && (pair.first & RBD_FEATURES_MUTABLE) == 0ULL) { + // hide non-mutable features for the 'rbd feature XYZ' command + continue; + } + if (!first_feature) { oss << ", "; }