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=46346aa2d0b12e247be17ba378e5bf46e9ded5ff;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 --- diff --git a/doc/rados/operations/placement-groups.rst b/doc/rados/operations/placement-groups.rst index 40b6a12b2f5..14d35937310 100644 --- a/doc/rados/operations/placement-groups.rst +++ b/doc/rados/operations/placement-groups.rst @@ -161,6 +161,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 451bcf8568c..03d601d0d44 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -240,13 +240,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", "" + @CLIReadCommand("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]