]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: jsonify output of "pool get" command 20745/head
authorChang Liu <liuchang0812@gmail.com>
Tue, 6 Mar 2018 11:44:50 +0000 (19:44 +0800)
committerChang Liu <liuchang0812@gmail.com>
Tue, 6 Mar 2018 12:44:51 +0000 (20:44 +0800)
Fixes: http://tracker.ceph.com/issues/23200
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
src/mon/OSDMonitor.cc

index ba0549bc8519336ec5ece40c200691a5b95b6e45..f069c4df135a2b353de53bf6034e67eeee10c2d8 100644 (file)
@@ -4259,6 +4259,9 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
     }
 
     if (f) {
+      f->open_object_section("pool");
+      f->dump_string("pool", poolstr);
+      f->dump_int("pool_id", pool);
       for(choices_set_t::const_iterator it = selected_choices.begin();
          it != selected_choices.end(); ++it) {
        choices_map_t::const_iterator i;
@@ -4268,12 +4271,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
           }
         }
         assert(i != ALL_CHOICES.end());
-        bool pool_opt = pool_opts_t::is_opt_name(i->first);
-        if (!pool_opt) {
-          f->open_object_section("pool");
-          f->dump_string("pool", poolstr);
-          f->dump_int("pool_id", pool);
-        }
        switch(*it) {
          case PG_NUM:
            f->dump_int("pg_num", p->get_pg_num());
@@ -4404,9 +4401,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
          case CSUM_MIN_BLOCK:
             pool_opts_t::key_t key = pool_opts_t::get_opt_desc(i->first).key;
             if (p->opts.is_set(key)) {
-              f->open_object_section("pool");
-              f->dump_string("pool", poolstr);
-              f->dump_int("pool_id", pool);
               if(*it == CSUM_TYPE) {
                 int val;
                 p->opts.get(pool_opts_t::CSUM_TYPE, &val);
@@ -4414,17 +4408,12 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
               } else {
                 p->opts.dump(i->first, f.get());
               }
-              f->close_section();
-              f->flush(rdata);
-            }
+           }
             break;
        }
-        if (!pool_opt) {
-         f->close_section();
-         f->flush(rdata);
-        }
       }
-
+      f->close_section();
+      f->flush(rdata);
     } else /* !f */ {
       for(choices_set_t::const_iterator it = selected_choices.begin();
          it != selected_choices.end(); ++it) {