]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: implement `config set`
authorJohn Spray <john.spray@redhat.com>
Wed, 12 Jul 2017 13:05:32 +0000 (09:05 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 21 Jul 2017 10:27:26 +0000 (06:27 -0400)
This is a friendlier replacement for injectargs.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osd/OSD.cc

index 5133ed4226d50ab096faa1816a8a54b8fd0b44a8..dfb64e4ad5ba692b067ccc330ba7f2ec01dcc198 100644 (file)
@@ -6233,6 +6233,10 @@ COMMAND("injectargs " \
        "name=injected_args,type=CephString,n=N",
        "inject configuration arguments into running OSD",
        "osd", "rw", "cli,rest")
+COMMAND("config set " \
+       "name=key,type=CephString name=value,type=CephString",
+       "Set a configuration option at runtime (not persistent)",
+       "osd", "rw", "cli,rest")
 COMMAND("cluster_log " \
        "name=level,type=CephChoices,strings=error,warning,info,debug " \
        "name=message,type=CephString,n=N",
@@ -6347,6 +6351,15 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     r = cct->_conf->injectargs(args, &ss);
     osd_lock.Lock();
   }
+  else if (prefix == "config set") {
+    std::string key;
+    std::string val;
+    cmd_getval(cct, cmdmap, "key", key);
+    cmd_getval(cct, cmdmap, "value", val);
+    osd_lock.Unlock();
+    r = cct->_conf->set_val(key, val, true, &ss);
+    osd_lock.Lock();
+  }
   else if (prefix == "cluster_log") {
     vector<string> msg;
     cmd_getval(cct, cmdmap, "message", msg);