]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: register commands separately
authorKefu Chai <kchai@redhat.com>
Sun, 16 Feb 2020 08:39:26 +0000 (16:39 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 16 Feb 2020 15:59:30 +0000 (23:59 +0800)
so we can do command registration in the same place, in future, we can
move all of them into another place if necessary

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/admin/admin_socket.cc
src/crimson/admin/admin_socket.h
src/crimson/osd/osd.cc

index 47f5201c43ab39fbdb60045d8356bd28b32346e4..9652acdba187ac6054dbfa5661b817b3bdf88ccd 100644 (file)
@@ -234,8 +234,7 @@ seastar::future<> AdminSocket::start(const std::string& path)
   logger().debug("{}: asok socket path={}", __func__, path);
   auto sock_path = seastar::socket_address{ seastar::unix_domain_addr{ path } };
 
-  std::ignore = register_admin_hooks().then([this, sock_path] {
-    return seastar::do_with(
+  std::ignore = return seastar::do_with(
       seastar::engine().listen(sock_path),
       [this](seastar::server_socket& lstn) {
         m_server_sock = &lstn;  // used for 'abort_accept()'
@@ -395,7 +394,7 @@ class GetdescsHook final : public AdminSocketHook {
 };
 
 /// the hooks that are served directly by the admin_socket server
-seastar::future<> AdminSocket::register_admin_hooks()
+seastar::future<> AdminSocket::register_admin_commands()
 {
   return seastar::when_all_succeed(
     register_command(std::make_unique<VersionHook>()),
index 0965ca7261c2515b59b8d2515aa3aba9bc90625d..f8c74d0b8df9a67f6f9f40c23b84315657c333be 100644 (file)
@@ -106,6 +106,11 @@ class AdminSocket : public seastar::enable_lw_shared_from_this<AdminSocket> {
    */
   seastar::future<> register_command(std::unique_ptr<AdminSocketHook>&& hook);
 
+  /**
+   * Registering the APIs that are served directly by the admin_socket server.
+   */
+  seastar::future<> register_admin_commands();
+
  private:
   /**
    * the result of analyzing an incoming command, and locating it in
@@ -119,11 +124,6 @@ class AdminSocket : public seastar::enable_lw_shared_from_this<AdminSocket> {
   // and the shorthand:
   using maybe_parsed_t = std::optional<AdminSocket::parsed_command_t>;
 
-  /**
-   * Registering the APIs that are served directly by the admin_socket server.
-   */
-  seastar::future<> register_admin_hooks();
-
   seastar::future<> handle_client(seastar::input_stream<char>& inp,
                                   seastar::output_stream<char>& out);
 
index cbb310ad3b4feb4fcf4ac4dbd633d2fcef9185bf..8657ce4353dcc90136f358e539ef8afc75f6bc0e 100644 (file)
@@ -409,6 +409,7 @@ seastar::future<> OSD::start_asok_admin()
   using namespace crimson::admin;
   return asok->start(asok_path).then([this] {
     return seastar::when_all_succeed(
+      asok->register_admin_commands(),
       asok->register_command(make_asok_hook<OsdStatusHook>(*this)),
       asok->register_command(make_asok_hook<SendBeaconHook>(*this)),
       asok->register_command(make_asok_hook<ConfigShowHook>()),