]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: implement `config set`
authorJohn Spray <john.spray@redhat.com>
Wed, 12 Jul 2017 14:10:06 +0000 (10:10 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Jul 2017 10:27:27 +0000 (06:27 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MonCommands.h
src/mon/Monitor.cc

index 010e4c99ff4dc9e1d71adbc1f986c00edaf55661..a9055041e6c586570cebda51c20a5d5ec1870308 100644 (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")
index 7969df17f57d4cb80148088f9db76fc612b70f45..9ec308d7832a06c744082785b104f2251a73a310 100644 (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") {