]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: sort to display group image by name 23896/head
authorsongweibin <song.weibin@zte.com.cn>
Mon, 3 Sep 2018 07:15:38 +0000 (15:15 +0800)
committersongweibin <song.weibin@zte.com.cn>
Wed, 12 Sep 2018 15:42:16 +0000 (23:42 +0800)
Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/tools/rbd/action/Group.cc

index 7cc9c299e8cd88a03832e0489d159dfce6d39d8d..4a5b6a21ffdaab2afa67d1936098cd8ae0420ee9 100644 (file)
@@ -428,6 +428,16 @@ int execute_list_images(const po::variables_map &vm,
   if (r < 0)
     return r;
 
+  std::sort(images.begin(), images.end(),
+    [](const librbd::group_image_info_t &lhs,
+       const librbd::group_image_info_t &rhs) {
+      if (lhs.pool != rhs.pool) {
+        return lhs.pool < rhs.pool;
+      }
+      return lhs.name < rhs.name;
+    }
+  );
+
   if (f)
     f->open_array_section("images");