]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMonitor: populate on-disk cmd descs if empty on upgrade
authorJoao Eduardo Luis <joao@suse.de>
Wed, 27 Sep 2017 16:55:17 +0000 (17:55 +0100)
committerJoao Eduardo Luis <joao@wipwd.org>
Fri, 29 Sep 2017 08:53:29 +0000 (09:53 +0100)
During kraken, when we first introduced the mgrs, we wouldn't populate
the on-disk command descriptions on create_initial(). Therefore, if we
are upgrading from a cluster that never had a mgr, we may end up
crashing because we have no cmd descs to load from disk.

Fixes: http://tracker.ceph.com/issues/21300
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/MgrMonitor.cc

index 3840b642b956cd9269522f8d172f0749690bf229..3a5ad7391260b5fd5e49e596e7b40a120838be8d 100644 (file)
@@ -108,6 +108,16 @@ void MgrMonitor::create_pending()
 {
   pending_map = map;
   pending_map.epoch++;
+
+  if (map.get_epoch() == 1 &&
+      command_descs.empty() &&
+      pending_command_descs.empty()) {
+    // we've been through the initial map and we haven't populated the
+    // command_descs vector. This likely means we came from kraken, where
+    // we wouldn't populate the vector, nor would we write it to disk, on
+    // create_initial().
+    create_initial();
+  }
 }
 
 health_status_t MgrMonitor::should_warn_about_mgr_down()