Skip to content

Commit f9efe0b

Browse files
committed
mon/MgrStatMonitor.cc: do not update score when disabled
This commit adds changes to ensure the availability score tracking is not updated when the feature is disabled. We will preserve the score calculated before the feature is turned off and start updating it again when the feature is enabled. Fixes: https://tracker.ceph.com/issues/71494 Signed-off-by: Shraddha Agrawal <[email protected]> (cherry picked from commit 017c9b9)
1 parent 431d732 commit f9efe0b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/mon/MgrStatMonitor.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ void MgrStatMonitor::create_initial()
6969
void MgrStatMonitor::calc_pool_availability()
7070
{
7171
dout(20) << __func__ << dendl;
72+
73+
// if feature is disabled by user, do not update the uptime
74+
// and downtime, exit early
75+
if (!g_conf().get_val<bool>("enable_availability_tracking")) {
76+
dout(20) << __func__ << " tracking availability score is disabled" << dendl;
77+
return;
78+
}
79+
7280
auto pool_avail_end = pool_availability.end();
7381
for (const auto& i : digest.pool_pg_unavailable_map) {
7482
const auto& poolid = i.first;

src/mon/OSDMonitor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14412,7 +14412,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
1441214412
} else if (prefix == "osd pool availability-status") {
1441314413
if (!g_conf().get_val<bool>("enable_availability_tracking")) {
1441414414
ss << "availability tracking is disabled; you can enable it by setting the config option enable_availability_tracking";
14415-
err = -EPERM;
14415+
err = -EOPNOTSUPP;
1441614416
goto reply_no_propose;
1441714417
}
1441814418
TextTable tbl;

0 commit comments

Comments
 (0)