From: Connor Fawcett Date: Wed, 13 Aug 2025 14:03:40 +0000 (+0100) Subject: mgr/pg_autoscaler: Add 'osd pool get threshold' command which returns the current... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09813f64f2f588c63a5979a328b2d901c05e075c;p=ceph.git mgr/pg_autoscaler: Add 'osd pool get threshold' command which returns the current threshold value Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2291435 Signed-off-by: Connor Fawcett (cherry picked from commit 46346aa2d0b12e247be17ba378e5bf46e9ded5ff) Conflicts: src/pybind/mgr/pg_autoscaler/module.py - CLIReadCommand changed to PGAutoscalerCLICommand.Read due to 4aa9e246f056 --- diff --git a/doc/rados/operations/placement-groups.rst b/doc/rados/operations/placement-groups.rst index 8177476b230..2a3ce011536 100644 --- a/doc/rados/operations/placement-groups.rst +++ b/doc/rados/operations/placement-groups.rst @@ -165,6 +165,12 @@ The output will resemble the following:: ceph osd pool set threshold 2.0 + To get the current ``threshold`` value, run the following command: + + .. prompt:: bash # + + ceph osd pool get threshold + - **AUTOSCALE** is the pool's ``pg_autoscale_mode`` and is set to ``on``, ``off``, or ``warn``. diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 3e77e35f869..eb96766dd1a 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -243,13 +243,23 @@ class PgAutoscaler(MgrModule): 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 + A.K.A. the factor by which the new pg_num must vary + from the existing pg_num before action is taken """ if num < 1.0: return 22, "", "threshold cannot be set less than 1.0" self.set_module_option("threshold", num) return 0, "threshold updated", "" + @PGAutoscalerCLICommand.Read("osd pool get threshold") + def get_scaling_threshold(self) -> Tuple[int, str, str]: + """ + return the autoscaler threshold value + A.K.A. the factor by which the new pg_num must vary + from the existing pg_num before action is taken + """ + return 0, str(self.get_module_option('threshold')), '' + def complete_all_progress_events(self) -> None: for pool_id in list(self._event): ev = self._event[pool_id]