]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/MgrStatMonitor.cc: do not update score when disabled
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 22 May 2025 08:20:57 +0000 (13:50 +0530)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 19 Jun 2025 11:52:34 +0000 (17:22 +0530)
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 <shraddhaag@ibm.com>
(cherry picked from commit 017c9b9f4fa0d3286d52b7acb7df912327b1f836)

src/mon/MgrStatMonitor.cc
src/mon/OSDMonitor.cc

index e568a491c438367db006bda554245121de26a16b..52121a63c05d37652fc4d6f6ce46057aac177ef6 100644 (file)
@@ -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<bool>("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;
index 3da45e2fabe39bb8f616a9e7b8efd947856fec3c..cc1f40a6edb7947ccd7c7dc13561cfcdb2e332cb 100644 (file)
@@ -14412,7 +14412,7 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
   } else if (prefix == "osd pool availability-status") {
     if (!g_conf().get_val<bool>("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;