From c74b2d9fc7d0c2a3fd7525158fa471e1b2cf5a82 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 12 Jul 2017 10:10:06 -0400 Subject: [PATCH] mon: implement `config set` Signed-off-by: John Spray --- src/mon/MonCommands.h | 4 ++++ src/mon/Monitor.cc | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 010e4c99ff4dc..a9055041e6c58 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 7969df17f57d4..9ec308d7832a0 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") { -- 2.39.5