From: Sage Weil Date: Mon, 22 Nov 2021 21:41:10 +0000 (-0500) Subject: mgr/pg_autoscaler: apply pg_num_max X-Git-Tag: v16.2.8~44^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8d83b6746ac07aa8770f4aa8d911d5635db31ead;p=ceph.git mgr/pg_autoscaler: apply pg_num_max Signed-off-by: Sage Weil (cherry picked from commit 73893f4d1c5d6599b784c814fdcf55db1c851068) Conflicts: src/pybind/mgr/pg_autoscaler/module.py - trivial-fix --- diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 06101878659..a33fca9a439 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -473,8 +473,11 @@ class PgAutoscaler(MgrModule): final_ratio = 1 / (pool_count - root_map[root_id].pool_used) pool_pg_target = (final_ratio * root_map[root_id].pg_left) / p['size'] * bias - final_pg_target = max(p.get('options', {}).get('pg_num_min', PG_NUM_MIN), - nearest_power_of_two(pool_pg_target)) + min_pg = p.get('options', {}).get('pg_num_min', PG_NUM_MIN) + max_pg = p.get('options', {}).get('pg_num_max') + final_pg_target = max(min_pg, nearest_power_of_two(pool_pg_target)) + if max_pg and max_pg < final_pg_target: + final_pg_target = max_pg self.log.info("Pool '{0}' root_id {1} using {2} of space, bias {3}, " "pg target {4} quantized to {5} (current {6})".format( p['pool_name'],