From dc797a255ede79a5806790e85fa646c9167dfedf Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sat, 24 Jun 2017 11:36:15 +0800 Subject: [PATCH] mon/OSDMonitor: make pg-up-items result a bit nicer ~#: ./bin/ceph osd pg-upmap-items 0.7 0 2 1 3 4 5 set 0.7 pg_upmap_items mapping to [0->2,1->3,4->5] Signed-off-by: xie xingguo --- src/mon/OSDMonitor.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e13fd3bde8bc2..0555b9f8da9d7 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8920,6 +8920,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, } vector> new_pg_upmap_items; + ostringstream items; + items << "["; for (auto p = id_vec.begin(); p != id_vec.end(); ++p) { int from = *p++; int to = *p; @@ -8934,13 +8936,16 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, goto reply; } new_pg_upmap_items.push_back(make_pair(from, to)); + items << from << "->" << to << ","; } + string out(items.str()); + out.resize(out.size() - 1); // drop last ',' + out += "]"; pending_inc.new_pg_upmap_items[pgid] = mempool::osdmap::vector>( new_pg_upmap_items.begin(), new_pg_upmap_items.end()); - ss << "set " << pgid << " pg_upmap_items mapping to " - << new_pg_upmap_items; + ss << "set " << pgid << " pg_upmap_items mapping to " << out; } break; -- 2.39.5