]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: move mgr_commands to separate compilation unit
authorSage Weil <sage@redhat.com>
Tue, 18 Jul 2017 20:00:28 +0000 (16:00 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 19 Jul 2017 12:58:40 +0000 (08:58 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/CMakeLists.txt
src/mgr/DaemonServer.cc
src/mgr/DaemonServer.h
src/mgr/Mgr.cc
src/mgr/mgr_commands.cc [new file with mode: 0644]
src/mgr/mgr_commands.h [new file with mode: 0644]

index a764c490e46cae7adfdbbab13cd6f9189e9943c6..862dd2b19abc7c539c381ed4b828f06e85a75716 100644 (file)
@@ -691,7 +691,8 @@ if (WITH_MGR)
       mgr/PyState.cc
       mgr/MgrPyModule.cc
       mgr/MgrStandby.cc
-      mgr/Mgr.cc)
+      mgr/Mgr.cc
+      mgr/mgr_commands.cc)
   add_executable(ceph-mgr ${mgr_srcs}
                  $<TARGET_OBJECTS:heap_profiler_objs>)
   target_include_directories(ceph-mgr PRIVATE "${PYTHON_INCLUDE_DIRS}")
index e54fd5a62550ce7b2b89f1c9b38f36bb11be197d..3259df587025b3226c43e95d444187360f1824f3 100644 (file)
@@ -17,6 +17,7 @@
 #include "auth/RotatingKeyRing.h"
 #include "json_spirit/json_spirit_writer.h"
 
+#include "mgr/mgr_commands.h"
 #include "mon/MonCommand.h"
 
 #include "messages/MMgrOpen.h"
 #define dout_prefix *_dout << "mgr.server " << __func__ << " "
 
 
-/* The set of statically defined (C++-handled) commands.  This
- * does not include the Python-defined commands, which are loaded
- * in PyModules */
-const std::vector<MonCommand> DaemonServer::mgr_commands = {
-#define COMMAND(parsesig, helptext, module, perm, availability) \
-  {parsesig, helptext, module, perm, availability, 0},
-#include "MgrCommands.h"
-#undef COMMAND
-};
-
 
 DaemonServer::DaemonServer(MonClient *monc_,
                            Finisher &finisher_,
index 1c5825502a2819c0a113791598e8eb4afe52954b..6e44832021510462107eb2e02b7df18c884c54d1 100644 (file)
@@ -95,8 +95,6 @@ private:
   void maybe_ready(int32_t osd_id);
 
 public:
-  static const std::vector<MonCommand> mgr_commands;
-
   int init(uint64_t gid, entity_addr_t client_addr);
   void shutdown();
 
index e46b2cabd63ba87dbabf952ce725531fa3e34644..dcadb254e9880cefa16b14b2c7cfa06888bd4d9d 100644 (file)
@@ -22,6 +22,7 @@
 #include "global/signal_handler.h"
 
 #include "mgr/MgrContext.h"
+#include "mgr/mgr_commands.h"
 
 #include "MgrPyModule.h"
 #include "DaemonServer.h"
@@ -637,7 +638,7 @@ std::vector<MonCommand> Mgr::get_command_set() const
 {
   Mutex::Locker l(lock);
 
-  std::vector<MonCommand> commands = DaemonServer::mgr_commands;
+  std::vector<MonCommand> commands = mgr_commands;
   std::vector<MonCommand> py_commands = py_modules.get_commands();
   commands.insert(commands.end(), py_commands.begin(), py_commands.end());
   return commands;
diff --git a/src/mgr/mgr_commands.cc b/src/mgr/mgr_commands.cc
new file mode 100644 (file)
index 0000000..aafee99
--- /dev/null
@@ -0,0 +1,14 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "mgr_commands.h"
+
+/* The set of statically defined (C++-handled) commands.  This
+ * does not include the Python-defined commands, which are loaded
+ * in PyModules */
+const std::vector<MonCommand> mgr_commands = {
+#define COMMAND(parsesig, helptext, module, perm, availability) \
+  {parsesig, helptext, module, perm, availability, 0},
+#include "MgrCommands.h"
+#undef COMMAND
+};
diff --git a/src/mgr/mgr_commands.h b/src/mgr/mgr_commands.h
new file mode 100644 (file)
index 0000000..c6ed6c6
--- /dev/null
@@ -0,0 +1,9 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include "mon/MonCommand.h"
+#include <vector>
+
+extern const std::vector<MonCommand> mgr_commands;