From f3980856c38e7a5871b55e543a94ec8c0f33e995 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 10 Sep 2019 07:06:11 -0500 Subject: [PATCH] common/ceph_context: add generic asok 'injectargs' Lots of scripts and users expect this, even though 'config set' is generally nicer to use. Signed-off-by: Sage Weil --- src/common/ceph_context.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 1cbc2aed5d8..7cddc4e3b6e 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -23,6 +23,7 @@ #include #include "include/mempool.h" +#include "include/stringify.h" #include "common/admin_socket.h" #include "common/code_environment.h" #include "common/ceph_mutex.h" @@ -589,7 +590,18 @@ void CephContext::do_command(std::string_view command, const cmdmap_t& cmdmap, f->open_object_section("diff"); _conf.diff(f, setting); f->close_section(); // unknown - } else if (command == "log flush") { + } + else if (command == "injectargs") { + vector argsvec; + cmd_getval(this, cmdmap, "injected_args", argsvec); + if (!argsvec.empty()) { + string args = joinify(argsvec.begin(), + argsvec.end(), + " "); + r = _conf.injectargs(args, &ss); + } + } + else if (command == "log flush") { _log->flush(); } else if (command == "log dump") { @@ -675,6 +687,7 @@ CephContext::CephContext(uint32_t module_type_, _admin_socket->register_command( "config diff get name=var,type=CephString", _admin_hook, "dump diff get : dump diff of current and default config setting "); + _admin_socket->register_command("injectargs name=injected_args,type=CephString,n=N", _admin_hook, "inject configuration arguments into running daemon"), _admin_socket->register_command("log flush", _admin_hook, "flush log entries to log file"); _admin_socket->register_command("log dump", _admin_hook, "dump recent log entries to log file"); _admin_socket->register_command("log reopen", _admin_hook, "reopen log file"); -- 2.39.5