]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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, 12 Jun 2025 10:49:50 +0000 (16:19 +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>
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 0804efb362b801d94abb10cac9668f6a55df9ad4..07b7cdbb64dec983829c75760f2ffa1c68e39a50 100644 (file)
@@ -14409,7 +14409,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;