]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: include disabled modules in `mgr module ls`
authorJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 10:35:14 +0000 (06:35 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 1 Nov 2017 23:03:29 +0000 (23:03 +0000)
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 <john.spray@redhat.com>
(cherry picked from commit 5861c4c022e825fe28347ba7e61ae86a6f260f24)

src/mon/MgrMonitor.cc

index bad3174eee6ded89a004f7f72a021f508466deb7..e713688999477518df74ce838df8dffd4b30dd75 100644 (file)
@@ -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);