From: John Spray Date: Wed, 1 Nov 2017 10:35:14 +0000 (-0400) Subject: mon: include disabled modules in `mgr module ls` X-Git-Tag: v12.2.2~61^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a80a7a4d7f9ac73b4d3b86f9787dd9de9865530a;p=ceph.git mon: include disabled modules in `mgr module ls` Otherwise, when someone wants to see what's possible to do with `mgr module enable` they have to trawl through the whole mgr map dump. Signed-off-by: John Spray (cherry picked from commit 5861c4c022e825fe28347ba7e61ae86a6f260f24) --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index bad3174eee6d..e71368899947 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -708,9 +708,20 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op) } f->flush(rdata); } else if (prefix == "mgr module ls") { - f->open_array_section("modules"); - for (auto& p : map.modules) { - f->dump_string("module", p); + f->open_object_section("modules"); + { + f->open_array_section("enabled_modules"); + for (auto& p : map.modules) { + f->dump_string("module", p); + } + f->close_section(); + f->open_array_section("disabled_modules"); + for (auto& p : map.available_modules) { + if (map.modules.count(p) == 0) { + f->dump_string("module", p); + } + } + f->close_section(); } f->close_section(); f->flush(rdata);