]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: 'list' action should connect to cluster before querying config
authorJason Dillaman <dillaman@redhat.com>
Tue, 4 Aug 2020 18:39:36 +0000 (14:39 -0400)
committerMykola Golub <mgolub@suse.com>
Mon, 14 Jun 2021 12:14:31 +0000 (15:14 +0300)
This will allow global config overrides for the max concurrent ops to
be applied prior to listing the images.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 1527dcfa6d57a1644fa569a3270cb72f058fae44)

src/tools/rbd/action/List.cc

index 67d9e4f8414202b4ce142d8343833f3d693068fd..65ab03752adaf4bcc8df8c44075369c13b886a5b 100644 (file)
@@ -168,13 +168,19 @@ int list_process_image(librados::Rados* rados, WorkerEntry* w, bool lflag, Forma
 }
 
 int do_list(const std::string &pool_name, const std::string& namespace_name,
-            bool lflag, int threads, Formatter *f) {
+            bool lflag, Formatter *f) {
   std::vector<WorkerEntry*> workers;
   std::vector<librbd::image_spec_t> images;
   librados::Rados rados;
   librbd::RBD rbd;
   librados::IoCtx ioctx;
 
+  int r = utils::init(pool_name, namespace_name, &rados, &ioctx);
+  if (r < 0) {
+    return r;
+  }
+
+  int threads = g_conf().get_val<uint64_t>("rbd_concurrent_management_ops");
   if (threads < 1) {
     threads = 1;
   }
@@ -182,11 +188,6 @@ int do_list(const std::string &pool_name, const std::string& namespace_name,
     threads = 32;
   }
 
-  int r = utils::init(pool_name, namespace_name, &rados, &ioctx);
-  if (r < 0) {
-    return r;
-  }
-
   utils::disable_cache();
 
   r = rbd.list2(ioctx, &images);
@@ -325,7 +326,6 @@ int execute(const po::variables_map &vm,
   }
 
   r = do_list(pool_name, namespace_name, vm["long"].as<bool>(),
-              g_conf().get_val<uint64_t>("rbd_concurrent_management_ops"),
               formatter.get());
   if (r < 0) {
     std::cerr << "rbd: listing images failed: " << cpp_strerror(r)