]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: define static mgr_commands at mkfs time
authorSage Weil <sage@redhat.com>
Tue, 18 Jul 2017 19:49:31 +0000 (15:49 -0400)
committerJohn Spray <john.spray@redhat.com>
Wed, 19 Jul 2017 12:58:41 +0000 (08:58 -0400)
This closes a window between mkfs and when the first mgr goes active
where *no* mgr commands are defined, and things like 'pg dump' fail.  We
do not get the default set of commands defined by modules, but we get
everything else.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/CMakeLists.txt
src/mon/MgrMonitor.cc

index 556157132f805da9c670de6dfe317baec9ddd17a..04044543c21bb46a711d95d511b4a9ecd3b68636 100644 (file)
@@ -20,7 +20,8 @@ set(lib_mon_srcs
   DataHealthService.cc
   PGMonitor.cc
   PGMap.cc
-  ConfigKeyService.cc)
+  ConfigKeyService.cc
+  ../mgr/mgr_commands.cc)
 add_library(mon STATIC
   ${lib_mon_srcs}
   $<TARGET_OBJECTS:kv_objs>
index bf70f7aee7290b3d6834589c5d57f0fd460e77c5..b858c5c0459cc1786ad73bd1ae62a706591f39d4 100644 (file)
@@ -20,6 +20,7 @@
 #include "PGStatService.h"
 #include "include/stringify.h"
 #include "mgr/MgrContext.h"
+#include "mgr/mgr_commands.h"
 #include "OSDMonitor.h"
 
 #include "MgrMonitor.h"
@@ -45,7 +46,10 @@ void MgrMonitor::create_initial()
   for (auto& m : tok) {
     pending_map.modules.insert(m);
   }
-  dout(10) << __func__ << " initial modules " << pending_map.modules << dendl;
+  pending_command_descs = mgr_commands;
+  dout(10) << __func__ << " initial modules " << pending_map.modules
+          << ", " << pending_command_descs.size() << " commands"
+          << dendl;
 }
 
 void MgrMonitor::update_from_paxos(bool *need_bootstrap)
@@ -79,10 +83,11 @@ void MgrMonitor::update_from_paxos(bool *need_bootstrap)
 
     check_subs();
 
-    if (map.get_available()
-        && (!old_available || old_gid != map.get_active_gid()))
-    {
-      dout(4) << "daemon transitioned to available, loading commands" << dendl;
+    if (version == 1
+       || (map.get_available()
+           && (!old_available || old_gid != map.get_active_gid()))) {
+      dout(4) << "mkfs or daemon transitioned to available, loading commands"
+             << dendl;
       bufferlist loaded_commands;
       int r = mon->store->get(command_descs_prefix, "", loaded_commands);
       if (r < 0) {