]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/pybind/mgr/pg_autoscaler/module.py: fix 'pg_autoscale_mode' output 54968/head
authorKamoltat <ksirivad@redhat.com>
Tue, 19 Dec 2023 20:21:50 +0000 (20:21 +0000)
committerKamoltat <ksirivad@redhat.com>
Fri, 26 Apr 2024 18:06:08 +0000 (18:06 +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>
src/pybind/mgr/pg_autoscaler/module.py

index ea7c4b00b4c68e4c5c6189bde7df7785dd83230f..2b22b75c0318c1d0399ec4bca5aee0311882cc79 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(), ''
@@ -663,6 +663,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,