From 5b603ec8e67e3b3c1c0d287ed3b603b4cbd10e81 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 5 Jan 2018 16:44:00 -0600 Subject: [PATCH] osd,mds: 'config unset' tell command Signed-off-by: Sage Weil --- src/mds/MDSDaemon.cc | 11 +++++++++++ src/osd/OSD.cc | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 066592bce95d2..4dac3c921eab6 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -659,6 +659,10 @@ COMMAND("config set " \ "name=key,type=CephString name=value,type=CephString", "Set a configuration option at runtime (not persistent)", "mds", "*", "cli,rest") +COMMAND("config unset " \ + "name=key,type=CephString", + "Unset a configuration option at runtime (not persistent)", + "mds", "*", "cli,rest") COMMAND("exit", "Terminate this MDS", "mds", "*", "cli,rest") @@ -799,6 +803,13 @@ int MDSDaemon::_handle_command( if (r == 0) { cct->_conf->apply_changes(nullptr); } + } else if (prefix == "config unset") { + std::string key; + cmd_getval(cct, cmdmap, "key", key); + r = cct->_conf->rm_val(key); + if (r == 0) { + cct->_conf->apply_changes(nullptr); + } } else if (prefix == "exit") { // We will send response before executing ss << "Exiting..."; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 009c5eb23bd0c..7d89eefa6b96f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5828,6 +5828,10 @@ COMMAND("config set " \ "name=key,type=CephString name=value,type=CephString", "Set a configuration option at runtime (not persistent)", "osd", "rw", "cli,rest") +COMMAND("config unset " \ + "name=key,type=CephString", + "Unset 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", @@ -5957,6 +5961,16 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector& cmd, buffe } osd_lock.Lock(); } + else if (prefix == "config unset") { + std::string key; + cmd_getval(cct, cmdmap, "key", key); + osd_lock.Unlock(); + r = cct->_conf->rm_val(key); + if (r == 0) { + cct->_conf->apply_changes(nullptr); + } + osd_lock.Lock(); + } else if (prefix == "cluster_log") { vector msg; cmd_getval(cct, cmdmap, "message", msg); -- 2.39.5