]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: adjusted "lock list" JSON and XML formatted output 19900/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 10 Jan 2018 19:46:07 +0000 (14:46 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 12 Jan 2018 16:31:07 +0000 (11:31 -0500)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
PendingReleaseNotes
qa/workunits/rbd/test_lock_fence.sh
src/test/cli-integration/rbd/formatted-output.t
src/tools/rbd/action/Lock.cc

index 1b30751de3b1e0002bab0f8ee3c732e39a263d88..8922cec2eba9450c736112f9920a02c3d2b49236 100644 (file)
@@ -1,10 +1,6 @@
 13.0.1
 ------
 
-* The RBD C API's rbd_discard method now enforces a maximum length of
-  2GB to match the C++ API's Image::discard method. This restriction
-  prevents overflow of the result code.
-
 * *CephFS*:
 
   * Several "ceph mds" commands have been obsoleted and replaced
     mds_session_timeout, mds_session_autoclose, and mds_max_file_size are now
     obsolete.
 
+* *RBD*
+
+  * The RBD C API's rbd_discard method now enforces a maximum length of
+    2GB to match the C++ API's Image::discard method. This restriction
+    prevents overflow of the result code.
+
+  * The rbd CLI's "lock list" JSON and XML output has changed.
+
 * The sample ``crush-location-hook`` script has been removed.  Its output is
   equivalent to the built-in default behavior, so it has been replaced with an
   example in the CRUSH documentation.
 
 
-
 >= 12.2.2
 ---------
 
index 1206da11aaf4f91850587885af5bb66157092099..e425e161d00284d61737d527a570ff85389bee07 100755 (executable)
@@ -14,8 +14,8 @@ python $RBDRW $IMAGE $LOCKID &
 iochild=$!
 
 # give client time to lock and start reading/writing
-LOCKS='{}'
-while [ "$LOCKS" == "{}" ]
+LOCKS='[]'
+while [ "$LOCKS" == '[]' ]
 do
     LOCKS=$(rbd lock list $IMAGE --format json)
     sleep 1
index 2b05d720d6e40f522fdc2b2df3ef7dd1c876a221..4c2faf934a1ecb230200167b33728b7e64754dbf 100644 (file)
@@ -746,7 +746,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   </images>
   $ rbd lock list foo
   $ rbd lock list foo --format json | python -mjson.tool | sed 's/,$/, /'
-  {}
+  []
   $ rbd lock list foo --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
   <locks></locks>
   $ rbd lock list quux
@@ -754,18 +754,20 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   Locker*ID*Address* (glob)
   client.* id * (glob)
   $ rbd lock list quux --format json | python -mjson.tool | sed 's/,$/, /'
-  {
-      "id": {
+  [
+      {
           "address": "*",  (glob)
+          "id": "id", 
           "locker": "client.*" (glob)
       }
-  }
+  ]
   $ rbd lock list quux --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
   <locks>
-    <id>
+    <lock>
+      <id>id</id>
       <locker>client.*</locker> (glob)
       <address>*</address> (glob)
-    </id>
+    </lock>
   </locks>
   $ rbd lock list baz
   There are 3 shared locks on this image.
@@ -775,34 +777,40 @@ whenever it is run. grep -v to ignore it, but still work on other distros.
   client.*id[123].* (re)
   client.*id[123].* (re)
   $ rbd lock list baz --format json | python -mjson.tool | sed 's/,$/, /'
-  {
-      "id1": {
+  [
+      {
           "address": "*",  (glob)
+          "id": "id*",  (glob)
           "locker": "client.*" (glob)
       }, 
-      "id2": {
+      {
           "address": "*",  (glob)
+          "id": "id*",  (glob)
           "locker": "client.*" (glob)
       }, 
-      "id3": {
+      {
           "address": "*",  (glob)
+          "id": "id*",  (glob)
           "locker": "client.*" (glob)
       }
-  }
+  ]
   $ rbd lock list baz --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp'
   <locks>
-    <id*> (glob)
+    <lock>
+      <id>id*</id> (glob)
       <locker>client.*</locker> (glob)
       <address>*</address> (glob)
-    </id*> (glob)
-    <id*> (glob)
+    </lock>
+    <lock>
+      <id>id*</id> (glob)
       <locker>client.*</locker> (glob)
       <address>*</address> (glob)
-    </id*> (glob)
-    <id*> (glob)
+    </lock>
+    <lock>
+      <id>id*</id> (glob)
       <locker>client.*</locker> (glob)
       <address>*</address> (glob)
-    </id*> (glob)
+    </lock>
   </locks>
   $ rbd snap list foo
   SNAPID NAME    SIZE TIMESTAMP 
index 60d63e8efd21cbc703baee254e86824fad5bdcf6..5b48190f158cdb6b4a52abcd022175abac00161c 100644 (file)
@@ -48,7 +48,7 @@ static int do_lock_list(librbd::Image& image, Formatter *f)
     return r;
 
   if (f) {
-    f->open_object_section("locks");
+    f->open_array_section("locks");
   } else {
     tbl.define_column("Locker", TextTable::LEFT, TextTable::LEFT);
     tbl.define_column("ID", TextTable::LEFT, TextTable::LEFT);
@@ -69,7 +69,8 @@ static int do_lock_list(librbd::Image& image, Formatter *f)
     for (std::list<librbd::locker_t>::const_iterator it = lockers.begin();
          it != lockers.end(); ++it) {
       if (f) {
-        f->open_object_section(it->cookie.c_str());
+        f->open_object_section("lock");
+        f->dump_string("id", it->cookie);
         f->dump_string("locker", it->client);
         f->dump_string("address", it->address);
         f->close_section();