]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: use 'ceph mon compact' instead of 'ceph compact'
authorJoao Eduardo Luis <joao@suse.de>
Fri, 8 May 2015 23:06:35 +0000 (00:06 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 11:20:02 +0000 (12:20 +0100)
Makes it easier to identify the command as being related with the
monitor instead of cluster-wide.

This entails adding an exception to module 'mon' in order to have this
command handled by the Monitor class instead of MonmapMonitor (which is
the one traditionally handling 'mon' module commands).

Fixes: #11545
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/MonCommands.h
src/mon/Monitor.cc

index 918db816e4c71e1db72dfe723c1fb0ddccd1172d..521b33f9749a04faa477617ac8bb6171af3997d0 100644 (file)
@@ -274,6 +274,15 @@ COMMAND_WITH_FLAG("version", "show mon daemon version", "mon", "r", "cli,rest",
 COMMAND("node ls " \
        "name=type,type=CephChoices,strings=all|osd|mon|mds,req=false",
        "list all nodes in cluster [type]", "mon", "r", "cli,rest")
+/*
+ * Monitor-specific commands under module 'mon'
+ */
+COMMAND_WITH_FLAG("mon compact", \
+    "cause compaction of monitor's leveldb storage", \
+    "mon", "rw", "cli,rest", \
+    FLAG(NOFORWARD))
+
+
 /*
  * MDS commands (MDSMonitor.cc)
  */
index ac1af1e5998f9c43b8334f2e3518947a75f3e1ff..5b8de2574668c7957cfd2ca1bd07d38955e4d547 100644 (file)
@@ -2692,7 +2692,9 @@ void Monitor::handle_command(MMonCommand *m)
     pgmon()->dispatch(m);
     return;
   }
-  if (module == "mon") {
+  if (module == "mon" &&
+      /* 'mon compact' will be handled by the Monitor class */
+      prefix != "mon compact") {
     monmon()->dispatch(m);
     return;
   }
@@ -2737,7 +2739,7 @@ void Monitor::handle_command(MMonCommand *m)
     return;
   }
 
-  if (prefix == "compact") {
+  if (prefix == "compact" || prefix == "mon compact") {
     dout(1) << "triggering manual compaction" << dendl;
     utime_t start = ceph_clock_now(g_ceph_context);
     store->compact();