]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrMap: use always_on_modules from most recent release
authorSage Weil <sage@redhat.com>
Tue, 31 Mar 2020 21:47:54 +0000 (16:47 -0500)
committerSage Weil <sage@newdream.net>
Wed, 8 Apr 2020 13:10:32 +0000 (08:10 -0500)
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 <sage@redhat.com>
src/mon/MgrMap.h

index e0fb172277f30d91b3c48ac163f4470221e50fe7..37be5c3c1c4413828f776c411b00d8db5dd936ce 100644 (file)
@@ -352,9 +352,19 @@ public:
   }
 
   std::set<std::string> get_always_on_modules() const {
-    auto it = always_on_modules.find(to_integer<uint32_t>(ceph_release()));
-    if (it == always_on_modules.end())
-      return {};
+    unsigned rnum = to_integer<uint32_t>(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;
   }