From: Joao Eduardo Luis Date: Wed, 27 Sep 2017 16:55:17 +0000 (+0100) Subject: mon/MgrMonitor: populate on-disk cmd descs if empty on upgrade X-Git-Tag: v12.2.2~182^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ee3f7ad21049d0692804d4405b4bf0f8c795ae3;p=ceph.git mon/MgrMonitor: populate on-disk cmd descs if empty on upgrade 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 --- diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index 3840b642b956..3a5ad7391260 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -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()