Skip to content

Commit 4f6a6ae

Browse files
Merge pull request ceph#65015 from connorfawcett/pg-autoscale-threshold-cmd
mgr/pg_autoscaler: Add 'osd pool get threshold' command which returns the current threshold value
2 parents 0f06551 + 46346aa commit 4f6a6ae

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

doc/rados/operations/placement-groups.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ The output will resemble the following::
161161

162162
ceph osd pool set threshold 2.0
163163

164+
To get the current ``threshold`` value, run the following command:
165+
166+
.. prompt:: bash #
167+
168+
ceph osd pool get threshold
169+
164170
- **AUTOSCALE** is the pool's ``pg_autoscale_mode`` and is set to ``on``,
165171
``off``, or ``warn``.
166172

src/pybind/mgr/pg_autoscaler/module.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,23 @@ def _command_autoscale_status(self, format: str = 'plain') -> Tuple[int, str, st
240240
def set_scaling_threshold(self, num: float) -> Tuple[int, str, str]:
241241
"""
242242
set the autoscaler threshold
243-
A.K.A. the factor by which the new PG_NUM must vary from the existing PG_NUM
243+
A.K.A. the factor by which the new pg_num must vary
244+
from the existing pg_num before action is taken
244245
"""
245246
if num < 1.0:
246247
return 22, "", "threshold cannot be set less than 1.0"
247248
self.set_module_option("threshold", num)
248249
return 0, "threshold updated", ""
249250

251+
@CLIReadCommand("osd pool get threshold")
252+
def get_scaling_threshold(self) -> Tuple[int, str, str]:
253+
"""
254+
return the autoscaler threshold value
255+
A.K.A. the factor by which the new pg_num must vary
256+
from the existing pg_num before action is taken
257+
"""
258+
return 0, str(self.get_module_option('threshold')), ''
259+
250260
def complete_all_progress_events(self) -> None:
251261
for pool_id in list(self._event):
252262
ev = self._event[pool_id]

0 commit comments

Comments
 (0)