]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: pass a string to Client::run_command()
authorKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 09:00:51 +0000 (17:00 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 11:04:28 +0000 (19:04 +0800)
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 <kchai@redhat.com>
src/crimson/mon/MonClient.cc
src/crimson/mon/MonClient.h
src/crimson/osd/osd.cc

index e72f45bb0e7154578edd4cb14de837ea432e40af..8c7326f3e35ac5479bda4e4c629f4f5e1cd031ef 100644 (file)
@@ -993,14 +993,14 @@ void Client::_finish_auth(const entity_addr_t& peer)
 }
 
 Client::command_result_t
-Client::run_command(const std::vector<std::string>& cmd,
-                    const bufferlist& bl)
+Client::run_command(std::string&& cmd,
+                    bufferlist&& bl)
 {
   auto m = make_message<MMonCommand>(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();
index 430260c3170814e21a8cfbb21741958fd61f33f7..8c2447b5e687ff4fbad16fe3fdccf39639d0a433 100644 (file)
@@ -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<std::string>& 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);
index 521cb9ba3bb180b30902811a2d4b849a31852f8b..a4a6eda4331abf8c28fc495ba87c1346329eae0b 100644 (file)
@@ -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) {