]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: simplify 'mgr module ls' output
authorLaura Flores <lflores@redhat.com>
Mon, 4 Oct 2021 22:39:23 +0000 (22:39 +0000)
committerLaura Flores <lflores@redhat.com>
Mon, 4 Oct 2021 23:36:57 +0000 (23:36 +0000)
Fixes: https://tracker.ceph.com/issues/45322
Signed-off-by: Laura Flores <lflores@redhat.com>
doc/man/8/ceph.rst
doc/mgr/administrator.rst
src/mon/MgrMonitor.cc
src/mon/MonCommands.h

index 639d85e565d6f23180764f0d998605e8441aef12..af381df92ea8a11d1d6c90555a144deab9f71e01 100644 (file)
@@ -580,7 +580,7 @@ Subcommand ``module ls`` will list currently enabled manager modules (plugins).
 
 Usage::
 
-  ceph mgr module ls
+  ceph mgr module ls {detail}
 
 Subcommand ``module enable`` will enable a manager module.  Available modules are included in MgrMap and visible via ``mgr dump``.
 
index 6fa563c62ad5eaf3ebb8a70179f2b1f571cf2532..6115d171c014c06938d3c9480ab9105ccf8cd170 100644 (file)
@@ -57,7 +57,8 @@ Using modules
 -------------
 
 Use the command ``ceph mgr module ls`` to see which modules are
-available, and which are currently enabled.  Enable or disable modules
+available, and which are currently enabled. Use ``ceph mgr module ls detail``
+to view detailed metadata about disabled modules. Enable or disable modules
 using the commands ``ceph mgr module enable <module>`` and
 ``ceph mgr module disable <module>`` respectively.
 
index ef246e648c6c1e034a1a87747c2cfb1405ca77b9..b2dae3ce8412aef1f803de3ad0735c7dff33f1c6 100644 (file)
@@ -953,6 +953,7 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op)
 
   string prefix;
   cmd_getval(cmdmap, "prefix", prefix);
+
   int r = 0;
 
   if (prefix == "mgr stat") {
@@ -982,6 +983,9 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op)
     }
     f->flush(rdata);
   } else if (prefix == "mgr module ls") {
+    string detail;
+    cmd_getval(cmdmap, "detail", detail);
+
     f->open_object_section("modules");
     {
       f->open_array_section("always_on_modules");
@@ -1002,9 +1006,14 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op)
       for (auto& p : map.available_modules) {
         if (map.modules.count(p.name) == 0 &&
             map.get_always_on_modules().count(p.name) == 0) {
-          // For disabled modules, we show the full info, to
-          // give a hint about whether enabling it will work
-          p.dump(f.get());
+         if (detail == "detail") {
+           // For disabled modules, we show the full info if the detail
+           // parameter is enabled, to give a hint about whether enabling it will work
+           p.dump(f.get());
+         } else {
+           // Otherwise, we give a shortened summary by default
+           f->dump_string("module", p.name);
+         }
         }
       }
       f->close_section();
index 1db98798733642032543d7395f99c75898a26510..78129f336e256fc885d01e745bf64f9572971b74 100644 (file)
@@ -1231,8 +1231,8 @@ COMMAND("mgr dump "
        "mgr", "r")
 COMMAND("mgr fail name=who,type=CephString,req=false",
        "treat the named manager daemon as failed", "mgr", "rw")
-COMMAND("mgr module ls",
-       "list active mgr modules", "mgr", "r")
+COMMAND("mgr module ls name=detail,type=CephChoices,strings=detail,req=false",
+        "list active mgr modules", "mgr", "r")
 COMMAND("mgr services",
        "list service endpoints provided by mgr modules",
         "mgr", "r")