From 5861c4c022e825fe28347ba7e61ae86a6f260f24 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 1 Nov 2017 06:35:14 -0400 Subject: [PATCH] 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 --- src/mon/MgrMonitor.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 3c0320aa8d39c..751ed45e81173 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -697,9 +697,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); -- 2.47.3