From 00b86644cd5ffdbb3f96ed1f174b11cbbcf0b90d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 5 Oct 2020 16:08:38 -0400 Subject: [PATCH] rbd: cleanup code and output formatting in status action Signed-off-by: Jason Dillaman --- src/tools/rbd/action/Status.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tools/rbd/action/Status.cc b/src/tools/rbd/action/Status.cc index db9b69bf6df..6e5e39a4230 100644 --- a/src/tools/rbd/action/Status.cc +++ b/src/tools/rbd/action/Status.cc @@ -174,12 +174,12 @@ static int do_show_status(librados::IoCtx& io_ctx, const std::string &image_name f->close_section(); // migration } if (cache_state.present) { - f->open_object_section("image_cache_state"); - f->dump_bool("clean", cache_state.clean); - f->dump_int("size", cache_state.size); - f->dump_string("host", cache_state.host); - f->dump_string("path", cache_state.path); - f->close_section(); // image_cache_state + f->open_object_section("image_cache_state"); + f->dump_bool("clean", cache_state.clean); + f->dump_int("size", cache_state.size); + f->dump_string("host", cache_state.host); + f->dump_string("path", cache_state.path); + f->close_section(); // image_cache_state } } else { if (watchers.size()) { @@ -201,7 +201,7 @@ static int do_show_status(librados::IoCtx& io_ctx, const std::string &image_name std::cout << "Migration:" << std::endl; std::cout << "\tsource: " << source_pool_name << "/" - << migration_status.source_image_name; + << migration_status.source_image_name; if (!migration_status.source_image_id.empty()) { std::cout << " (" << migration_status.source_image_id << ")"; } @@ -217,11 +217,12 @@ static int do_show_status(librados::IoCtx& io_ctx, const std::string &image_name } if (cache_state.present) { - std::cout << "image cache state:" << std::endl; + std::cout << "Image cache state:" << std::endl; std::cout << "\tclean: " << (cache_state.clean ? "true" : "false") - << " size: " << byte_u_t(cache_state.size) - << " host: " << cache_state.host - << " path: " << cache_state.path << std::endl; + << std::endl + << "\tsize: " << byte_u_t(cache_state.size) << std::endl + << "\thost: " << cache_state.host << std::endl + << "\tpath: " << cache_state.path << std::endl; } } -- 2.39.5