]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/ConfigMonitor: add 'config ls'
authorSage Weil <sage@redhat.com>
Wed, 27 Feb 2019 17:37:47 +0000 (11:37 -0600)
committerSage Weil <sage@redhat.com>
Wed, 27 Feb 2019 17:37:47 +0000 (11:37 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/ConfigMonitor.cc
src/mon/MgrMonitor.h
src/mon/MonCommands.h

index 3e83d499a20ef7d7e6c7b45697f8c09ee7ca7004..3e08b8a49f0ca2c797f4ad5bfefd41d7e4e52b3d 100644 (file)
@@ -176,6 +176,31 @@ bool ConfigMonitor::preprocess_command(MonOpRequestRef op)
     } else {
       odata.append(ss.str());
     }
+  } else if (prefix == "config ls") {
+    ostringstream ss;
+    if (f) {
+      f->open_array_section("options");
+    }
+    for (auto& i : ceph_options) {
+      if (f) {
+       f->dump_string("option", i.name);
+      } else {
+       ss << i.name << "\n";
+      }
+    }
+    for (auto& i : mon->mgrmon()->get_mgr_module_options()) {
+      if (f) {
+       f->dump_string("option", i.first);
+      } else {
+       ss << i.first << "\n";
+      }
+    }
+    if (f) {
+      f->close_section();
+      f->flush(odata);
+    } else {
+      odata.append(ss.str());
+    }
   } else if (prefix == "config dump") {
     list<pair<string,Section*>> sections = {
       make_pair("global", &config_map.global)
index 0fc031403b25179927e9394fbe4da3256bcb570e..7d6edba958afc6d9d54948085dcca252886d02d4 100644 (file)
@@ -81,6 +81,9 @@ public:
 
   const MgrMap &get_map() const { return map; }
 
+  const std::map<std::string,Option>& get_mgr_module_options() {
+    return mgr_module_options;
+  }
   const Option *find_module_option(const string& name);
 
   bool in_use() const { return map.epoch > 0; }
index d2d9812a5b04d4261692d14bfa1d9b9ac45af526..ec2f2cc9b533905e3d5c886dce3474fc1c105f6d 100644 (file)
@@ -1162,6 +1162,9 @@ COMMAND("config help " \
        "name=key,type=CephString",
        "Describe a configuration option",
        "config", "r")
+COMMAND("config ls",
+       "List available configuration options",
+       "config", "r")
 COMMAND("config assimilate-conf",
        "Assimilate options from a conf, and return a new, minimal conf file",
        "config", "rw")