]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerJason Dillaman <dillaman@redhat.com>
Thu, 20 Aug 2020 14:40:38 +0000 (10:40 -0400)
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>
src/tools/rbd/action/List.cc

index b42695b31b3c4378e9b5a0b8c228ed71a418bdb0..b63f97aeb23bc1468a55cfc7aed2321b912a491d 100644 (file)
@@ -169,13 +169,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;
   }
@@ -183,11 +189,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);
@@ -326,7 +327,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)