From: Shraddha Agrawal Date: Thu, 22 May 2025 08:20:57 +0000 (+0530) Subject: mon/MgrStatMonitor.cc: do not update score when disabled X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=017c9b9f4fa0d3286d52b7acb7df912327b1f836;p=ceph.git 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 --- diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index e568a491c4383..52121a63c05d3 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 0804efb362b80..07b7cdbb64dec 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -14409,7 +14409,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;