]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/pg_autoscaler: add check for norecover flag 57568/head
authorAishwarya Mathuria <amathuri@redhat.com>
Thu, 26 Oct 2023 13:14:10 +0000 (13:14 +0000)
committerAishwarya Mathuria <amathuri@redhat.com>
Mon, 20 May 2024 12:26:37 +0000 (17:56 +0530)
The PG autoscaler should not be active when the norecover flag is set.
As each newly split PG will need to be backfilled, it does not make sense to have the autoscaler active if the norecover flag is set.

Fixes: https://tracker.ceph.com/issues/63334
Signed-off-by: Aishwarya Mathuria <amathuri@redhat.com>
(cherry picked from commit 009832f07abe2bf051965097f550d8695e9cebd4)

src/pybind/mgr/pg_autoscaler/module.py

index 9099d96756b53cd9770ce5bcbd4d5a96136876c0..2ac89f56975fd4fb05447ddac2754afdd59490e9 100644 (file)
@@ -260,6 +260,13 @@ class PgAutoscaler(MgrModule):
         else:
             return False
 
+    def has_norecover_flag(self) -> bool:
+        flags = self.get_osdmap().dump().get('flags', '')
+        if 'norecover' in flags:
+            return True
+        else:
+            return False
+
     @CLIWriteCommand("osd pool get noautoscale")
     def get_noautoscale(self) -> Tuple[int, str, str]:
         """
@@ -321,7 +328,7 @@ class PgAutoscaler(MgrModule):
     def serve(self) -> None:
         self.config_notify()
         while not self._shutdown.is_set():
-            if not self.has_noautoscale_flag():
+            if not self.has_noautoscale_flag() and not self.has_norecover_flag():
                 osdmap = self.get_osdmap()
                 pools = osdmap.get_pools_by_name()
                 self._maybe_adjust(osdmap, pools)