From dc9a28652428225aedced204645440688d20d035 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 31 Mar 2020 16:47:54 -0500 Subject: [PATCH] mon/MgrMap: use always_on_modules from most recent release If our release isn't in the always_on_map, say because you just upgraded, then start with the modules from the last/most recent release. This should be sufficient to allow an upgrade when the mon is still the old release and the mgrmap doesn't tell us what modules we should be enabling. (Arguably, the always_on_modules should be enshrined in the MgrMap itself and not in the mon?) Signed-off-by: Sage Weil --- src/mon/MgrMap.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/mon/MgrMap.h b/src/mon/MgrMap.h index e0fb172277f30..37be5c3c1c441 100644 --- a/src/mon/MgrMap.h +++ b/src/mon/MgrMap.h @@ -352,9 +352,19 @@ public: } std::set get_always_on_modules() const { - auto it = always_on_modules.find(to_integer(ceph_release())); - if (it == always_on_modules.end()) - return {}; + unsigned rnum = to_integer(ceph_release()); + auto it = always_on_modules.find(rnum); + if (it == always_on_modules.end()) { + // ok, try the most recent release + if (always_on_modules.empty()) { + return {}; // ugh + } + --it; + if (it->first < rnum) { + return it->second; + } + return {}; // wth + } return it->second; } -- 2.39.5