From: Laura Flores Date: Mon, 4 Oct 2021 22:39:23 +0000 (+0000) Subject: mon: simplify 'mgr module ls' output X-Git-Tag: v17.1.0~466^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a10be53475ce370e5b66d2ccc2f75ca5f36af8d;p=ceph.git mon: simplify 'mgr module ls' output Fixes: https://tracker.ceph.com/issues/45322 Signed-off-by: Laura Flores --- diff --git a/doc/man/8/ceph.rst b/doc/man/8/ceph.rst index 639d85e565d..af381df92ea 100644 --- a/doc/man/8/ceph.rst +++ b/doc/man/8/ceph.rst @@ -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``. diff --git a/doc/mgr/administrator.rst b/doc/mgr/administrator.rst index 6fa563c62ad..6115d171c01 100644 --- a/doc/mgr/administrator.rst +++ b/doc/mgr/administrator.rst @@ -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 `` and ``ceph mgr module disable `` respectively. diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index ef246e648c6..b2dae3ce841 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -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(); diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 1db98798733..78129f336e2 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -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")