Skip to content

Commit 017c9b9

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]>
1 parent 9ccef70 commit 017c9b9

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
@@ -14409,7 +14409,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
1440914409
} else if (prefix == "osd pool availability-status") {
1441014410
if (!g_conf().get_val<bool>("enable_availability_tracking")) {
1441114411
ss << "availability tracking is disabled; you can enable it by setting the config option enable_availability_tracking";
14412-
err = -EPERM;
14412+
err = -EOPNOTSUPP;
1441314413
goto reply_no_propose;
1441414414
}
1441514415
TextTable tbl;

0 commit comments

Comments
 (0)