From 98a802ab7a819c3d16aec38e4a4a83be2e1f97fa Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Fri, 30 Dec 2016 11:31:00 +0100 Subject: [PATCH] rbd: remove unused condition Signed-off-by: Gaurav Kumar Garg --- src/tools/rbd/action/Group.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd/action/Group.cc b/src/tools/rbd/action/Group.cc index 5a8dcd532560b..6fbaefdee6df4 100644 --- a/src/tools/rbd/action/Group.cc +++ b/src/tools/rbd/action/Group.cc @@ -261,11 +261,13 @@ int execute_list_images(const po::variables_map &vm) { if (r == -ENOENT) r = 0; + if (r < 0) return r; if (f) f->open_array_section("consistency_groups"); + for (auto i : images) { std::string image_name = i.name; int64_t pool_id = i.pool; @@ -274,8 +276,6 @@ int execute_list_images(const po::variables_map &vm) { if (cls::rbd::GROUP_IMAGE_LINK_STATE_INCOMPLETE == state) { state_string = "incomplete"; } - if (r < 0) - return r; if (f) { f->dump_string("image name", image_name); f->dump_int("pool id", pool_id); @@ -283,6 +283,7 @@ int execute_list_images(const po::variables_map &vm) { } else std::cout << pool_id << "." << image_name << " " << state_string << std::endl; } + if (f) { f->close_section(); f->flush(std::cout);