]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/pybind/mgr/pg_autoscaler/module.py: fix 'pg_autoscale_mode' output
authorKamoltat <ksirivad@redhat.com>
Tue, 19 Dec 2023 20:21:50 +0000 (20:21 +0000)
committerroot <root@vossi06.front.sepia.ceph.com>
Mon, 26 Aug 2024 20:27:56 +0000 (20:27 +0000)
Problem:
`ceph osd pool autoscale-status -f json`
and `ceph osd pool autoscale-status`
shows discrepeencies between each other
in the `pg_autoscale_mode` section,
when `no_autoscale` flag is set.

Solution:

set `pg_autoscale_mode` to `false` for
both `ceph osd pool autoscale-status` and
the json version of the command if `no_autoscale`
is set.

Fixes: https://tracker.ceph.com/issues/63860
Signed-off-by: Kamoltat <ksirivad@redhat.com>
(cherry picked from commit bd8d7e9695644fe4a7f178172eb42a0b5602f458)

src/pybind/mgr/pg_autoscaler/module.py

index 0ab26387790daebe72cb3fa1e5a8b4f30534f31e..451bcf8568cb3ad420b58eedd8b8feb3cada3cb0 100644 (file)
@@ -231,7 +231,7 @@ class PgAutoscaler(MgrModule):
                     p['pg_num_target'],
 #                    p['pg_num_ideal'],
                     final,
-                    'off' if self.has_noautoscale_flag() else p['pg_autoscale_mode'],
+                    str(p['pg_autoscale_mode']),
                     str(p['bulk'])
                 ])
             return 0, table.get_string(), ''
@@ -670,6 +670,11 @@ class PgAutoscaler(MgrModule):
         ret, _, _ = self._get_pool_pg_targets(osdmap, even_pools, crush_map, root_map,
                                          pool_stats, ret, threshold, 'third', overlapped_roots)
 
+        # If noautoscale flag is set, we set pg_autoscale_mode to off
+        if self.has_noautoscale_flag():
+            for p in ret:
+                p['pg_autoscale_mode'] = 'off'
+
         return (ret, root_map)
 
     def _get_pool_by_id(self,