summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/pg_autoscaler
diff options
context:
space:
mode:
authorJosh Durgin <jdurgin@redhat.com>2020-02-01 20:59:13 +0100
committerKefu Chai <kchai@redhat.com>2020-02-10 03:08:36 +0100
commit772d7c1d3c1adf49821670da0f6cdb06e293dc0d (patch)
tree8b92dd95be050f68f1ef546ef4a348da707de4a7 /src/pybind/mgr/pg_autoscaler
parentmgr/pg_autoscaler: remove target ratio warning (diff)
downloadceph-772d7c1d3c1adf49821670da0f6cdb06e293dc0d.tar.xz
ceph-772d7c1d3c1adf49821670da0f6cdb06e293dc0d.zip
mgr/pg_autoscaler: add warning when target bytes and ratio are both set
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
Diffstat (limited to 'src/pybind/mgr/pg_autoscaler')
-rw-r--r--src/pybind/mgr/pg_autoscaler/module.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py
index 12b1e13ffa9..62e29464e0c 100644
--- a/src/pybind/mgr/pg_autoscaler/module.py
+++ b/src/pybind/mgr/pg_autoscaler/module.py
@@ -427,6 +427,7 @@ class PgAutoscaler(MgrModule):
# drop them from consideration.
too_few = []
too_many = []
+ bytes_and_ratio = []
health_checks = {}
total_bytes = dict([(r, 0) for r in iter(root_map)])
@@ -435,6 +436,9 @@ class PgAutoscaler(MgrModule):
for p in ps:
pool_id = str(p['pool_id'])
+ pool_opts = pools[p['pool_name']]['options']
+ if pool_opts.get('target_size_ratio', 0) > 0 and pool_opts.get('target_size_bytes', 0) > 0:
+ bytes_and_ratio.append('Pool %s has target_size_bytes and target_size_ratio set' % p['pool_name'])
total_bytes[p['crush_root_id']] += max(
p['actual_raw_used'],
p['target_bytes'] * p['raw_used_rate'])
@@ -546,5 +550,12 @@ class PgAutoscaler(MgrModule):
'detail': too_much_target_bytes,
}
+ if bytes_and_ratio:
+ health_checks['POOL_HAS_TARGET_SIZE_BYTES_AND_RATIO'] = {
+ 'severity': 'warning',
+ 'summary': "%d pools have both target_size_bytes and target_size_ratio set" % len(bytes_and_ratio),
+ 'count': len(bytes_and_ratio),
+ 'detail': bytes_and_ratio,
+ }
self.set_health_checks(health_checks)