diff options
author | John Spray <john.spray@redhat.com> | 2017-07-12 13:57:10 +0200 |
---|---|---|
committer | John Spray <john.spray@redhat.com> | 2017-07-21 12:27:26 +0200 |
commit | 241a547ba1d20311fa8ba594e5a6bea0e45f4dd2 (patch) | |
tree | a61fd89fbf2cacc97b6fdb4241a8b103e5cabe63 /src/common/ceph_context.cc | |
parent | rgw: treat config ints as 64 bit (diff) | |
download | ceph-241a547ba1d20311fa8ba594e5a6bea0e45f4dd2.tar.xz ceph-241a547ba1d20311fa8ba594e5a6bea0e45f4dd2.zip |
common: implement "config help" to output schema
Signed-off-by: John Spray <john.spray@redhat.com>
Diffstat (limited to 'src/common/ceph_context.cc')
-rw-r--r-- | src/common/ceph_context.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index be83c442b87..1d5c6facade 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -448,6 +448,27 @@ void CephContext::do_command(std::string command, cmdmap_t& cmdmap, f->dump_string(var.c_str(), buf); } } + } else if (command == "config help") { + std::string var; + if (cmd_getval(this, cmdmap, "var", var)) { + // Output a single one + std::string key = ConfFile::normalize_key_name(var); + const auto &i = _conf->schema.find(key); + if (i == _conf->schema.end()) { + std::ostringstream msg; + msg << "Setting not found: '" << key << "'"; + f->dump_string("error", msg.str()); + } else { + i->second.dump(f); + } + } else { + // Output all + f->open_array_section("options"); + for (const auto &option : ceph_options) { + option.dump(f); + } + f->close_section(); + } } else if (command == "config diff") { md_config_t def_conf; def_conf.set_val("cluster", _conf->cluster); @@ -601,6 +622,7 @@ CephContext::CephContext(uint32_t module_type_, int init_flags_) _admin_socket->register_command("perf histogram schema", "perf histogram schema", _admin_hook, "dump perf histogram schema"); _admin_socket->register_command("perf reset", "perf reset name=var,type=CephString", _admin_hook, "perf reset <name>: perf reset all or one perfcounter name"); _admin_socket->register_command("config show", "config show", _admin_hook, "dump current config settings"); + _admin_socket->register_command("config help", "config help name=var,type=CephString,req=false", _admin_hook, "get config setting schema and descriptions"); _admin_socket->register_command("config set", "config set name=var,type=CephString name=val,type=CephString,n=N", _admin_hook, "config set <field> <val> [<val> ...]: set a config variable"); _admin_socket->register_command("config get", "config get name=var,type=CephString", _admin_hook, "config get <field>: get the config value"); _admin_socket->register_command("config diff", @@ -648,6 +670,7 @@ CephContext::~CephContext() _admin_socket->unregister_command("config show"); _admin_socket->unregister_command("config set"); _admin_socket->unregister_command("config get"); + _admin_socket->unregister_command("config help"); _admin_socket->unregister_command("config diff"); _admin_socket->unregister_command("config diff get"); _admin_socket->unregister_command("log flush"); |