]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: hide implicit / non-mutable features from the CLI help
authorJason Dillaman <dillaman@redhat.com>
Fri, 5 Jan 2018 16:31:37 +0000 (11:31 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 12 Jan 2018 02:30:08 +0000 (21:30 -0500)
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 <dillaman@redhat.com>
src/include/rbd/features.h
src/test/cli/rbd/help.t
src/tools/rbd/ArgumentTypes.cc

index efdcf0e8e6682663c38e3fcc7f8ef2d50e5c4c7c..651fff8e5e7887a9d9a9492dc45dbde003fc3135 100644 (file)
@@ -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
index 532c26ae0e06d0cb35127f3afbdf431bfb6863b4..3f5fdb5fd8c4b604afb7851442f609ec970fd209 100644 (file)
@@ -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-spec>         image specification
                          (example: [<pool-name>/]<image-name>)
     <features>           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-spec>              image specification
                               (example: [<pool-name>/]<image-name>)
     <features>                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
index 13c31b7d8740bb18ecb15cd5ab064783284e6dea..18a99daedf1bc63c33df131576309304ee8ac19b 100644 (file)
@@ -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 << ", ";
     }