From: Kefu Chai Date: Tue, 2 Mar 2021 09:00:51 +0000 (+0800) Subject: crimson/mon: pass a string to Client::run_command() X-Git-Tag: v17.1.0~2790^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d30e4c2318d81357b6b1e6755d820259d4069d32;p=ceph-ci.git crimson/mon: pass a string to Client::run_command() as the reason why MMonCommand uses a vector is but for legacy reasons, there is no need to expose this via the interface. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index e72f45bb0e7..8c7326f3e35 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -993,14 +993,14 @@ void Client::_finish_auth(const entity_addr_t& peer) } Client::command_result_t -Client::run_command(const std::vector& cmd, - const bufferlist& bl) +Client::run_command(std::string&& cmd, + bufferlist&& bl) { auto m = make_message(monmap.fsid); auto tid = ++last_mon_command_id; m->set_tid(tid); - m->cmd = cmd; - m->set_data(bl); + m->cmd = {std::move(cmd)}; + m->set_data(std::move(bl)); auto& req = mon_commands[tid]; return send_message(m).then([&req] { return req.get_future(); diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h index 430260c3170..8c2447b5e68 100644 --- a/src/crimson/mon/MonClient.h +++ b/src/crimson/mon/MonClient.h @@ -82,8 +82,8 @@ public: return monmap.fsid; } get_version_t get_version(const std::string& map); - command_result_t run_command(const std::vector& cmd, - const bufferlist& bl); + command_result_t run_command(std::string&& cmd, + bufferlist&& bl); seastar::future<> send_message(MessageRef); bool sub_want(const std::string& what, version_t start, unsigned flags); void sub_got(const std::string& what, version_t have); diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 521cb9ba3bb..a4a6eda4331 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -404,7 +404,7 @@ seastar::future<> OSD::_add_me_to_crush() "weight": {:.4f}, "args": [{}] }})", whoami, weight, loc); - return monc->run_command({cmd}, {}); + return monc->run_command(std::move(cmd), {}); }).then([](auto&& command_result) { [[maybe_unused]] auto [code, message, out] = std::move(command_result); if (code) {