From 27e16aa565c546649d11a4c178367518b53b0e34 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Oct 2019 21:40:21 -0500 Subject: [PATCH] mds: convert '{session,client} config' Signed-off-by: Sage Weil --- src/mds/MDSDaemon.cc | 14 +++++++++----- src/mds/MDSRank.cc | 16 +++------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 2e54ce37815c..32cd36f15e66 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -350,7 +350,15 @@ void MDSDaemon::set_up_admin_socket() asok_hook, "Enumerate connected CephFS clients"); ceph_assert(r == 0); - r = admin_socket->register_command("session config name=client_id,type=CephInt,req=true " + r = admin_socket->register_command("session config " + "name=client_id,type=CephInt,req=true " + "name=option,type=CephString,req=true " + "name=value,type=CephString,req=false ", + asok_hook, + "Config a CephFS client session"); + assert(r == 0); + r = admin_socket->register_command("client config " + "name=client_id,type=CephInt,req=true " "name=option,type=CephString,req=true " "name=value,type=CephString,req=false ", asok_hook, @@ -624,10 +632,6 @@ void MDSDaemon::handle_command(const cref_t &m) const std::vector& MDSDaemon::get_commands() { static const std::vector commands = { - MDSCommand("session config name=client_id,type=CephInt name=option,type=CephString name=value,type=CephString,req=false", - "Config a client session"), - MDSCommand("client config name=client_id,type=CephInt name=option,type=CephString name=value,type=CephString,req=false", - "Config a client session"), MDSCommand("damage ls", "List detected metadata damage"), MDSCommand("damage rm name=damage_id,type=CephInt", "Remove a damage table entry"), MDSCommand("cache drop name=timeout,type=CephInt,range=0,req=false", "trim cache and optionally request client to release all caps and flush the journal"), diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 479f140271a1..849985188fda 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2515,7 +2515,8 @@ void MDSRankDispatcher::handle_asok_command( dout(15) << ss.str() << dendl; r = -ENOENT; } - } else if (command == "session config") { + } else if (command == "session config" || + command == "client config") { int64_t client_id; std::string option; std::string value; @@ -3539,18 +3540,7 @@ bool MDSRankDispatcher::handle_command( std::string prefix; cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); - if (prefix == "session config" || prefix == "client config") { - int64_t client_id; - std::string option; - std::string value; - - cmd_getval(g_ceph_context, cmdmap, "client_id", client_id); - cmd_getval(g_ceph_context, cmdmap, "option", option); - bool got_value = cmd_getval(g_ceph_context, cmdmap, "value", value); - - *r = config_client(client_id, !got_value, option, value, *ss); - return true; - } else if (prefix == "damage ls") { + if (prefix == "damage ls") { JSONFormatter f(true); damage_table.dump(&f); f.flush(*ds); -- 2.47.3