From f9efe0b17348a7be5f4ebe00a90f5c0e88aabada Mon Sep 17 00:00:00 2001 From: Shraddha Agrawal Date: Thu, 22 May 2025 13:50:57 +0530 Subject: [PATCH] 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 (cherry picked from commit 017c9b9f4fa0d3286d52b7acb7df912327b1f836) --- src/mon/MgrStatMonitor.cc | 8 ++++++++ src/mon/OSDMonitor.cc | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index e568a491c43..52121a63c05 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -69,6 +69,14 @@ void MgrStatMonitor::create_initial() void MgrStatMonitor::calc_pool_availability() { dout(20) << __func__ << dendl; + + // if feature is disabled by user, do not update the uptime + // and downtime, exit early + if (!g_conf().get_val("enable_availability_tracking")) { + dout(20) << __func__ << " tracking availability score is disabled" << dendl; + return; + } + auto pool_avail_end = pool_availability.end(); for (const auto& i : digest.pool_pg_unavailable_map) { const auto& poolid = i.first; diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 3da45e2fabe..cc1f40a6edb 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -14412,7 +14412,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, } else if (prefix == "osd pool availability-status") { if (!g_conf().get_val("enable_availability_tracking")) { ss << "availability tracking is disabled; you can enable it by setting the config option enable_availability_tracking"; - err = -EPERM; + err = -EOPNOTSUPP; goto reply_no_propose; } TextTable tbl; -- 2.39.5