From a84e4dfd63db216c767d6a94218b326b337ca236 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 12 Aug 2021 10:49:38 -0700 Subject: [PATCH] Add CLI command to set threshold Signed-off-by: Kyle McGough --- doc/rados/operations/placement-groups.rst | 2 +- src/pybind/mgr/pg_autoscaler/module.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/rados/operations/placement-groups.rst b/doc/rados/operations/placement-groups.rst index d282d9e5bee..90e3238d197 100644 --- a/doc/rados/operations/placement-groups.rst +++ b/doc/rados/operations/placement-groups.rst @@ -91,7 +91,7 @@ always a power of 2, and will only be present if the "ideal" value varies from the current value by more than a factor of 3 by default. This factor can be be adjusted with:: - ceph config set mgr mgr/pg_autoscaler/threshold 2.0 + ceph osd pool set threshold 2.0 **AUTOSCALE**, is the pool ``pg_autoscale_mode`` and will be either ``on``, ``off``, or ``warn``. diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 24487c7a3a3..926c0b5d842 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -252,6 +252,17 @@ class PgAutoscaler(MgrModule): ]) return 0, table.get_string(), '' + @CLIWriteCommand("osd pool set threshold") + def set_scaling_threshold(self, num: float) -> Tuple[int, str, str]: + """ + set the autoscaler threshold + A.K.A. the factor by which the new PG_NUM must vary from the existing PG_NUM + """ + if num < 2.0: + return 22, "", "threshold can not be set less than 2.0" + self.set_module_option("threshold", num) + return 0, "threshold updated", "" + @CLIWriteCommand("osd pool set autoscale-profile scale-up") def set_profile_scale_up(self) -> Tuple[int, str, str]: """ -- 2.47.3