]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/admin: drop prefix from cmd desc
authorKefu Chai <kchai@redhat.com>
Tue, 4 Aug 2020 07:08:02 +0000 (15:08 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 4 Aug 2020 07:28:47 +0000 (15:28 +0800)
there is no need to repeat the prefix in the command's description,
validate_cmd() skips it anyway.

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

index 21d97b8093b18e2a3c87c89d31d6c70143dd9ef0..d70eb28fd3bc56c4327a223b70b2991cf2ce7838 100644 (file)
@@ -295,7 +295,7 @@ seastar::future<> AdminSocket::stop()
 class VersionHook final : public AdminSocketHook {
  public:
   VersionHook()
-    : AdminSocketHook{"version", "version", "get ceph version"}
+    : AdminSocketHook{"version", "", "get ceph version"}
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
                                      std::string_view format,
@@ -318,7 +318,7 @@ class VersionHook final : public AdminSocketHook {
 class GitVersionHook final : public AdminSocketHook {
  public:
   GitVersionHook()
-    : AdminSocketHook{"git_version", "git_version", "get git sha1"}
+    : AdminSocketHook{"git_version", "", "get git sha1"}
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
                                      std::string_view format,
@@ -337,7 +337,7 @@ class HelpHook final : public AdminSocketHook {
 
  public:
   explicit HelpHook(const AdminSocket& as) :
-    AdminSocketHook{"help", "help", "list available commands"},
+    AdminSocketHook{"help", "", "list available commands"},
     m_as{as}
   {}
 
@@ -366,7 +366,7 @@ class GetdescsHook final : public AdminSocketHook {
  public:
   explicit GetdescsHook(const AdminSocket& as) :
     AdminSocketHook{"get_command_descriptions",
-                   "get_command_descriptions",
+                   "",
                    "list available commands"},
     m_as{ as } {}
 
@@ -380,9 +380,9 @@ class GetdescsHook final : public AdminSocketHook {
       f->open_object_section("command_descriptions");
       for (const auto& [prefix, hook] : m_as) {
        auto secname = fmt::format("cmd {:>03}", cmdnum);
+        auto cmd = fmt::format("{} {}", hook->prefix, hook->desc);
         dump_cmd_and_help_to_json(f.get(), CEPH_FEATURES_ALL, secname,
-                                  std::string{hook->desc},
-                                 std::string{hook->help});
+                                  cmd, std::string{hook->help});
         cmdnum++;
       }
       f->close_section();
@@ -394,9 +394,9 @@ class GetdescsHook final : public AdminSocketHook {
 class InjectArgsHook final : public AdminSocketHook {
 public:
   InjectArgsHook()
-    : AdminSocketHook("injectargs",
-                     "injectargs name=injected_args,type=CephString,n=N",
-                     "inject configuration arguments into running daemon")
+    : AdminSocketHook{"injectargs",
+                      "name=injected_args,type=CephString,n=N",
+                      "inject configuration arguments into running daemon"}
   {}
   seastar::future<tell_result_t> call(const cmdmap_t& cmdmap,
                                      std::string_view format,
@@ -420,10 +420,10 @@ public:
  */
 class ConfigShowHook : public AdminSocketHook {
 public:
-  explicit ConfigShowHook() :
-  AdminSocketHook("config show",
-                 "config show",
-                  "dump current config settings")
+  ConfigShowHook() :
+    AdminSocketHook{"config show",
+                    "",
+                    "dump current config settings"}
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
                                       std::string_view format,
@@ -444,7 +444,7 @@ class ConfigGetHook : public AdminSocketHook {
 public:
   ConfigGetHook() :
     AdminSocketHook("config get",
-                    "config get name=var,type=CephString",
+                    "name=var,type=CephString",
                     "config get <field>: get the config value")
   {}
   seastar::future<tell_result_t> call(const cmdmap_t& cmdmap,
@@ -482,9 +482,8 @@ class ConfigSetHook : public AdminSocketHook {
 public:
   ConfigSetHook()
     : AdminSocketHook("config set",
-                      "config set"
-                      " name=var,type=CephString"
-                      " name=val,type=CephString,n=N",
+                      "name=var,type=CephString "
+                      "name=val,type=CephString,n=N",
                       "config set <field> <val> [<val> ...]: set a config variable")
   {}
   seastar::future<tell_result_t> call(const cmdmap_t& cmdmap,
index e4f5f401df4f0875f18563a529813d00e62115cf..c6a6625b926599a25f4453143b3e3ca98f6d64a5 100644 (file)
@@ -35,7 +35,7 @@ std::unique_ptr<AdminSocketHook> make_asok_hook(Args&&... args)
 class OsdStatusHook : public AdminSocketHook {
 public:
   explicit OsdStatusHook(crimson::osd::OSD& osd) :
-    AdminSocketHook("status", "status", "OSD status"),
+    AdminSocketHook{"status", "", "OSD status"},
     osd(osd)
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
@@ -60,9 +60,9 @@ make_asok_hook<OsdStatusHook>(crimson::osd::OSD& osd);
 class SendBeaconHook : public AdminSocketHook {
 public:
   explicit SendBeaconHook(crimson::osd::OSD& osd) :
-    AdminSocketHook("send_beacon",
-                   "send_beacon",
-                   "send OSD beacon to mon immediately"),
+    AdminSocketHook{"send_beacon",
+                   "",
+                   "send OSD beacon to mon immediately"},
     osd(osd)
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
@@ -86,7 +86,7 @@ class FlushPgStatsHook : public AdminSocketHook {
 public:
   explicit FlushPgStatsHook(crimson::osd::OSD& osd) :
     AdminSocketHook("flush_pg_stats",
-                   "flush_pg_stats",
+                   "",
                    "flush pg stats"),
     osd{osd}
   {}
@@ -112,9 +112,9 @@ template std::unique_ptr<AdminSocketHook> make_asok_hook<FlushPgStatsHook>(crims
 class AssertAlwaysHook : public AdminSocketHook {
 public:
   AssertAlwaysHook()  :
-    AdminSocketHook("assert",
-                    "assert",
-                    "asserts")
+    AdminSocketHook{"assert",
+                   "",
+                   "asserts"}
   {}
   seastar::future<tell_result_t> call(const cmdmap_t&,
                                      std::string_view format,