From 1527dcfa6d57a1644fa569a3270cb72f058fae44 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 4 Aug 2020 14:39:36 -0400 Subject: [PATCH] rbd: 'list' action should connect to cluster before querying config This will allow global config overrides for the max concurrent ops to be applied prior to listing the images. Signed-off-by: Jason Dillaman --- src/tools/rbd/action/List.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tools/rbd/action/List.cc b/src/tools/rbd/action/List.cc index b42695b31b3..b63f97aeb23 100644 --- a/src/tools/rbd/action/List.cc +++ b/src/tools/rbd/action/List.cc @@ -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 workers; std::vector 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("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(), - g_conf().get_val("rbd_concurrent_management_ops"), formatter.get()); if (r < 0) { std::cerr << "rbd: listing images failed: " << cpp_strerror(r) -- 2.39.5