From: xie xingguo Date: Sat, 24 Jun 2017 03:36:15 +0000 (+0800) Subject: mon/OSDMonitor: make pg-up-items result a bit nicer X-Git-Tag: v12.1.2~1^2~27^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dc797a255ede79a5806790e85fa646c9167dfedf;p=ceph.git 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e13fd3bde8b..0555b9f8da9 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;