From: Sage Weil Date: Mon, 22 Nov 2021 21:41:10 +0000 (-0500) Subject: mgr/pg_autoscaler: apply pg_num_max X-Git-Tag: v17.1.0~123^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=73893f4d1c5d6599b784c814fdcf55db1c851068;p=ceph.git mgr/pg_autoscaler: apply pg_num_max Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 414afa7ce4954..047294bccd536 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -413,8 +413,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'],