Skip to content

Commit 3c53054

Browse files
committed
MgrMonitor: consider the build config when defining the always-on modules
Signed-off-by: Leonid Usov <[email protected]>
1 parent 1fd2d36 commit 3c53054

File tree

1 file changed

+29
-75
lines changed

1 file changed

+29
-75
lines changed

src/mon/MgrMonitor.cc

Lines changed: 29 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -70,77 +70,31 @@ static ostream& _prefix(std::ostream *_dout, Monitor &mon,
7070

7171
// the system treats always_on_modules as if they provide built-in functionality
7272
// by ensuring that they are always enabled.
73-
const static std::map<uint32_t, std::set<std::string>> always_on_modules = {
74-
{
75-
CEPH_RELEASE_OCTOPUS, {
76-
"crash",
77-
"status",
78-
"progress",
79-
"balancer",
80-
"devicehealth",
81-
"orchestrator",
82-
"rbd_support",
83-
"volumes",
84-
"pg_autoscaler",
85-
"telemetry",
86-
}
87-
},
88-
{
89-
CEPH_RELEASE_PACIFIC, {
90-
"crash",
91-
"status",
92-
"progress",
93-
"balancer",
94-
"devicehealth",
95-
"orchestrator",
96-
"rbd_support",
97-
"volumes",
98-
"pg_autoscaler",
99-
"telemetry",
100-
}
101-
},
102-
{
103-
CEPH_RELEASE_QUINCY, {
104-
"crash",
105-
"status",
106-
"progress",
107-
"balancer",
108-
"devicehealth",
109-
"orchestrator",
110-
"rbd_support",
111-
"volumes",
112-
"pg_autoscaler",
113-
"telemetry",
114-
}
115-
},
116-
{
117-
CEPH_RELEASE_REEF, {
118-
"crash",
119-
"status",
120-
"progress",
121-
"balancer",
122-
"devicehealth",
123-
"orchestrator",
124-
"rbd_support",
125-
"volumes",
126-
"pg_autoscaler",
127-
"telemetry",
128-
}
129-
},
130-
{
131-
CEPH_RELEASE_SQUID, {
132-
"crash",
133-
"status",
134-
"progress",
135-
"balancer",
136-
"devicehealth",
137-
"orchestrator",
138-
"rbd_support",
139-
"volumes",
140-
"pg_autoscaler",
141-
"telemetry",
142-
}
143-
},
73+
static const std::map<uint32_t, std::set<std::string>>& always_on_modules() {
74+
static const std::set<std::string> octopus_modules = {
75+
"crash",
76+
"status",
77+
"progress",
78+
"balancer",
79+
"devicehealth",
80+
"orchestrator",
81+
#ifdef WITH_RBD
82+
"rbd_support",
83+
#endif
84+
#ifdef WITH_CEPHFS
85+
"volumes",
86+
#endif
87+
"pg_autoscaler",
88+
"telemetry",
89+
};
90+
static const std::map<uint32_t, std::set<std::string>> always_on_modules_map = {
91+
{ CEPH_RELEASE_OCTOPUS, octopus_modules },
92+
{ CEPH_RELEASE_PACIFIC, octopus_modules },
93+
{ CEPH_RELEASE_QUINCY, octopus_modules },
94+
{ CEPH_RELEASE_REEF, octopus_modules },
95+
{ CEPH_RELEASE_SQUID, octopus_modules },
96+
};
97+
return always_on_modules_map;
14498
};
14599

146100
// Prefix for mon store of active mgr's command descriptions
@@ -190,7 +144,7 @@ void MgrMonitor::create_initial()
190144
for (auto& m : tok) {
191145
pending_map.modules.insert(m);
192146
}
193-
pending_map.always_on_modules = always_on_modules;
147+
pending_map.always_on_modules = always_on_modules();
194148
pending_command_descs = mgr_commands;
195149
dout(10) << __func__ << " initial modules " << pending_map.modules
196150
<< ", always on modules " << pending_map.get_always_on_modules()
@@ -769,13 +723,13 @@ void MgrMonitor::on_active()
769723
}
770724
mon.clog->debug() << "mgrmap e" << map.epoch << ": " << map;
771725
assert(HAVE_FEATURE(mon.get_quorum_con_features(), SERVER_NAUTILUS));
772-
if (pending_map.always_on_modules == always_on_modules) {
726+
if (pending_map.always_on_modules == always_on_modules()) {
773727
return;
774728
}
775729
dout(4) << "always on modules changed, pending "
776730
<< pending_map.always_on_modules << " != wanted "
777-
<< always_on_modules << dendl;
778-
pending_map.always_on_modules = always_on_modules;
731+
<< always_on_modules() << dendl;
732+
pending_map.always_on_modules = always_on_modules();
779733
propose_pending();
780734
}
781735

0 commit comments

Comments
 (0)