mon: implement config set

Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2017-07-12 10:10:06 -04:00
parent a1cf36bfc0
commit c74b2d9fc7
2 changed files with 12 additions and 0 deletions

View File

@ -211,6 +211,10 @@ COMMAND_WITH_FLAG("injectargs " \
"name=injected_args,type=CephString,n=N", \
"inject config arguments into monitor", "mon", "rw", "cli,rest",
FLAG(NOFORWARD))
COMMAND("config set " \
"name=key,type=CephString name=value,type=CephString",
"Set a configuration option at runtime (not persistent)",
"mon", "rw", "cli,rest")
COMMAND("status", "show cluster status", "mon", "r", "cli,rest")
COMMAND("health name=detail,type=CephChoices,strings=detail,req=false", \
"show cluster health", "mon", "r", "cli,rest")

View File

@ -3261,6 +3261,14 @@ void Monitor::handle_command(MonOpRequestRef op)
f->flush(rdata);
r = 0;
rs = "";
} else if (prefix == "config set") {
std::string key;
cmd_getval(cct, cmdmap, "key", key);
std::string val;
cmd_getval(cct, cmdmap, "value", val);
r = g_conf->set_val(key, val, true, &ss);
rs = ss.str();
goto out;
} else if (prefix == "status" ||
prefix == "health" ||
prefix == "df") {