diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 010e4c99ff4..a9055041e6c 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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") diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 7969df17f57..9ec308d7832 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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") {