]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: dump op features in image info
authorJason Dillaman <dillaman@redhat.com>
Tue, 16 Jan 2018 20:50:08 +0000 (15:50 -0500)
committerJason Dillaman <dillaman@redhat.com>
Sat, 27 Jan 2018 13:02:45 +0000 (08:02 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/cli-integration/rbd/formatted-output.t
src/tools/rbd/action/Info.cc

index 4c2faf934a1ecb230200167b33728b7e64754dbf..eae9d4ea01fb8ac26f07412df660ca334327a0d8 100644 (file)
@@ -118,6 +118,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   $ rbd info bar --format json | python -mjson.tool | sed 's/,$/, /'
@@ -136,6 +137,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "bar", 
       "object_size": 4194304, 
       "objects": 256, 
+      "op_features": [], 
       "order": 22, 
       "size": 1073741824
   }
@@ -155,6 +157,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>fast-diff</feature>
       <feature>deep-flatten</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
   </image>
@@ -165,6 +168,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   \tprotected: True (esc)
@@ -184,6 +188,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "bar", 
       "object_size": 4194304, 
       "objects": 128, 
+      "op_features": [], 
       "order": 22, 
       "protected": "true", 
       "size": 536870912
@@ -204,6 +209,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>fast-diff</feature>
       <feature>deep-flatten</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
     <protected>true</protected>
@@ -215,6 +221,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   \tprotected: False (esc)
@@ -234,6 +241,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "bar", 
       "object_size": 4194304, 
       "objects": 256, 
+      "op_features": [], 
       "order": 22, 
       "protected": "false", 
       "size": 1073741824
@@ -254,6 +262,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>fast-diff</feature>
       <feature>deep-flatten</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
     <protected>false</protected>
@@ -265,6 +274,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   $ rbd info baz --format json | python -mjson.tool | sed 's/,$/, /'
@@ -279,6 +289,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "baz", 
       "object_size": 4194304, 
       "objects": 512, 
+      "op_features": [], 
       "order": 22, 
       "size": 2147483648
   }
@@ -294,6 +305,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
     <features>
       <feature>layering</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
   </image>
@@ -330,6 +342,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   $ rbd info rbd_other/child --format json | python -mjson.tool | sed 's/,$/, /'
@@ -347,6 +360,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "child", 
       "object_size": 4194304, 
       "objects": 128, 
+      "op_features": [], 
       "order": 22, 
       "size": 536870912
   }
@@ -365,6 +379,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>object-map</feature>
       <feature>fast-diff</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
   </image>
@@ -375,6 +390,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   \tprotected: False (esc)
@@ -395,6 +411,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "child", 
       "object_size": 4194304, 
       "objects": 128, 
+      "op_features": [], 
       "order": 22, 
       "parent": {
           "image": "bar", 
@@ -420,6 +437,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>object-map</feature>
       <feature>fast-diff</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
     <protected>false</protected>
@@ -437,6 +455,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   $ rbd info rbd_other/deep-flatten-child --format json | python -mjson.tool | sed 's/,$/, /'
@@ -455,6 +474,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "deep-flatten-child", 
       "object_size": 4194304, 
       "objects": 128, 
+      "op_features": [], 
       "order": 22, 
       "size": 536870912
   }
@@ -474,6 +494,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>fast-diff</feature>
       <feature>deep-flatten</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
   </image>
@@ -484,6 +505,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   [^^]+ (re)
   \tformat: 2 (esc)
   \tfeatures: layering, exclusive-lock, object-map, fast-diff, deep-flatten (esc)
+  \top_features:  (esc)
   \tflags:  (esc)
   \tcreate_timestamp:* (glob)
   \tprotected: False (esc)
@@ -503,6 +525,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       "name": "deep-flatten-child", 
       "object_size": 4194304, 
       "objects": 128, 
+      "op_features": [], 
       "order": 22, 
       "protected": "false", 
       "size": 536870912
@@ -523,6 +546,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
       <feature>fast-diff</feature>
       <feature>deep-flatten</feature>
     </features>
+    <op_features></op_features>
     <flags></flags>
     <create_timestamp>*</create_timestamp> (glob)
     <protected>false</protected>
index 5ed9c70eab224815b9a1444370854f1457435a48..8f462ba1fadcfc5006e7d533527933b57780ff54 100644 (file)
@@ -56,6 +56,15 @@ static void format_features(Formatter *f, uint64_t features)
   format_bitmask(f, "feature", at::ImageFeatures::FEATURE_MAPPING, features);
 }
 
+static void format_op_features(Formatter *f, uint64_t op_features)
+{
+  static std::map<uint64_t, std::string> mapping = {
+    {RBD_OPERATION_FEATURE_CLONE_V2, RBD_OPERATION_FEATURE_NAME_CLONE_V2},
+    {RBD_OPERATION_FEATURE_GROUP, RBD_OPERATION_FEATURE_NAME_GROUP},
+    {RBD_OPERATION_FEATURE_SNAP_TRASH, RBD_OPERATION_FEATURE_NAME_SNAP_TRASH}};
+  format_bitmask(f, "op_feature", mapping, op_features);
+}
+
 static void format_flags(Formatter *f, uint64_t flags)
 {
   std::map<uint64_t, std::string> mapping = {
@@ -106,6 +115,12 @@ static int do_show_info(librados::IoCtx &io_ctx, librbd::Image& image,
   if (r < 0)
     return r;
 
+  uint64_t op_features;
+  r = image.get_op_features(&op_features);
+  if (r < 0) {
+    return r;
+  }
+
   r = image.get_flags(&flags);
   if (r < 0) {
     return r;
@@ -197,6 +212,7 @@ static int do_show_info(librados::IoCtx &io_ctx, librbd::Image& image,
 
   if (!old_format) {
     format_features(f, features);
+    format_op_features(f, op_features);
     format_flags(f, flags);
   }