]> 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)
committerNathan Cutler <ncutler@suse.com>
Wed, 8 Nov 2017 10:22:30 +0000 (11:22 +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>
(cherry picked from commit 9ee3f7ad21049d0692804d4405b4bf0f8c795ae3)
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
(cherry picked from commit e271bed9d43d91393a08351001fffe6e3ad84054)

src/mon/MgrMonitor.cc

index 59d4d635732e3efd5c9fd24698e3f186912bc7d4..1d43ec90255ce36ffd9cd8230a83648be2f1d895 100644 (file)
@@ -115,6 +115,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()