]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make pg-up-items result a bit nicer
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 24 Jun 2017 03:36:15 +0000 (11:36 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 26 Jun 2017 12:23:26 +0000 (20:23 +0800)
~#: ./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 <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc

index e13fd3bde8bc26ff6cd01eac371c8f711c2f1829..0555b9f8da9d771a9ef4302a94136e9caa84e7dc 100644 (file)
@@ -8920,6 +8920,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
         }
 
         vector<pair<int32_t,int32_t>> 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<pair<int32_t,int32_t>>(
           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;