]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MgrMonitor: consider the build config when defining the always-on modules 54955/head
authorLeonid Usov <leonid.usov@ibm.com>
Mon, 18 Dec 2023 23:30:01 +0000 (01:30 +0200)
committerLeonid Usov <leonid.usov@ibm.com>
Mon, 1 Apr 2024 13:56:53 +0000 (09:56 -0400)
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
src/mon/MgrMonitor.cc

index 3c37865721d02b2854c4a4f9cbb4a18798880917..034f584a95d565d936793ed02161cd51c51f9ad0 100644 (file)
@@ -70,77 +70,31 @@ static ostream& _prefix(std::ostream *_dout, Monitor &mon,
 
 // the system treats always_on_modules as if they provide built-in functionality
 // by ensuring that they are always enabled.
-const static std::map<uint32_t, std::set<std::string>> always_on_modules = {
-  {
-    CEPH_RELEASE_OCTOPUS, {
-      "crash",
-      "status",
-      "progress",
-      "balancer",
-      "devicehealth",
-      "orchestrator",
-      "rbd_support",
-      "volumes",
-      "pg_autoscaler",
-      "telemetry",
-    }
-  },
-  {
-    CEPH_RELEASE_PACIFIC, {
-      "crash",
-      "status",
-      "progress",
-      "balancer",
-      "devicehealth",
-      "orchestrator",
-      "rbd_support",
-      "volumes",
-      "pg_autoscaler",
-      "telemetry",
-    }
-  },
-  {
-    CEPH_RELEASE_QUINCY, {
-      "crash",
-      "status",
-      "progress",
-      "balancer",
-      "devicehealth",
-      "orchestrator",
-      "rbd_support",
-      "volumes",
-      "pg_autoscaler",
-      "telemetry",
-    }
-  },
-  {
-    CEPH_RELEASE_REEF, {
-      "crash",
-      "status",
-      "progress",
-      "balancer",
-      "devicehealth",
-      "orchestrator",
-      "rbd_support",
-      "volumes",
-      "pg_autoscaler",
-      "telemetry",
-    }
-  },
-  {
-    CEPH_RELEASE_SQUID, {
-      "crash",
-      "status",
-      "progress",
-      "balancer",
-      "devicehealth",
-      "orchestrator",
-      "rbd_support",
-      "volumes",
-      "pg_autoscaler",
-      "telemetry",
-    }
-  },
+static const std::map<uint32_t, std::set<std::string>>& always_on_modules() {
+  static const std::set<std::string> octopus_modules = {
+    "crash",
+    "status",
+    "progress",
+    "balancer",
+    "devicehealth",
+    "orchestrator",
+#ifdef WITH_RBD
+    "rbd_support",
+#endif
+#ifdef WITH_CEPHFS
+    "volumes",
+#endif
+    "pg_autoscaler",
+    "telemetry",
+  };
+  static const std::map<uint32_t, std::set<std::string>> always_on_modules_map = {
+    { CEPH_RELEASE_OCTOPUS, octopus_modules },
+    { CEPH_RELEASE_PACIFIC, octopus_modules },
+    { CEPH_RELEASE_QUINCY, octopus_modules },
+    { CEPH_RELEASE_REEF, octopus_modules },
+    { CEPH_RELEASE_SQUID, octopus_modules },
+  };
+  return always_on_modules_map;
 };
 
 // Prefix for mon store of active mgr's command descriptions
@@ -190,7 +144,7 @@ void MgrMonitor::create_initial()
   for (auto& m : tok) {
     pending_map.modules.insert(m);
   }
-  pending_map.always_on_modules = always_on_modules;
+  pending_map.always_on_modules = always_on_modules();
   pending_command_descs = mgr_commands;
   dout(10) << __func__ << " initial modules " << pending_map.modules
           << ", always on modules " << pending_map.get_always_on_modules()
@@ -769,13 +723,13 @@ void MgrMonitor::on_active()
   }
   mon.clog->debug() << "mgrmap e" << map.epoch << ": " << map;
   assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
-  if (pending_map.always_on_modules == always_on_modules) {
+  if (pending_map.always_on_modules == always_on_modules()) {
     return;
   }
   dout(4) << "always on modules changed, pending "
           << pending_map.always_on_modules << " != wanted "
-          << always_on_modules << dendl;
-  pending_map.always_on_modules = always_on_modules;
+          << always_on_modules() << dendl;
+  pending_map.always_on_modules = always_on_modules();
   propose_pending();
 }