]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PGMap dump shouldn't use strings containing '+' as tags
authorDan Mick <dan.mick@inktank.com>
Tue, 23 Jul 2013 07:04:02 +0000 (00:04 -0700)
committerDan Mick <dan.mick@inktank.com>
Tue, 23 Jul 2013 21:04:15 +0000 (14:04 -0700)
XML has a problem with tags containing +, like the PG state names.
Use an enclosing array, and name the state and count items explicitly.

Fixes: #5721
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/mon/PGMap.cc

index 8b37376ba7ad1540e67e8b2f1e689efc98b4630b..86ad87bd929ea6228fcd3f4a2440bf9eff3ebff0 100644 (file)
@@ -788,12 +788,16 @@ void PGMap::print_summary(Formatter *f, ostream *out) const
 {
   std::stringstream ss;
   if (f)
-    f->open_object_section("pgs_by_state");
+    f->open_array_section("pgs_by_state");
+
   for (hash_map<int,int>::const_iterator p = num_pg_by_state.begin();
        p != num_pg_by_state.end();
        ++p) {
     if (f) {
-      f->dump_unsigned(pg_state_string(p->first).c_str(), p->second);
+      f->open_object_section("pgs_by_state_element");
+      f->dump_string("state_name", pg_state_string(p->first));
+      f->dump_unsigned("count", p->second);
+      f->close_section();
     } else {
       if (p != num_pg_by_state.begin())
        ss << ", ";