]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/pg_autoscaler: add warning when target bytes and ratio are both set
authorJosh Durgin <jdurgin@redhat.com>
Sat, 1 Feb 2020 19:59:13 +0000 (14:59 -0500)
committerJosh Durgin <jdurgin@redhat.com>
Thu, 19 Mar 2020 20:39:57 +0000 (16:39 -0400)
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
(cherry picked from commit 772d7c1d3c1adf49821670da0f6cdb06e293dc0d)

doc/rados/operations/health-checks.rst
qa/workunits/mon/pg_autoscaler.sh
src/pybind/mgr/pg_autoscaler/module.py

index 6cfe869742589877939ec1307e54d811aa04a2ed..0b55059b42f5cacdd190bc1389e8db93c3e8dd82 100644 (file)
@@ -744,6 +744,21 @@ the pool is too large and should be reduced or set to zero with::
 
 For more information, see :ref:`specifying_pool_target_size`.
 
+POOL_HAS_TARGET_SIZE_BYTES_AND_RATIO
+____________________________________
+
+One or more pools have both ``target_size_bytes`` and
+``target_size_ratio`` set to estimate the expected size of the pool.
+Only one of these properties should be non-zero. If both are set,
+``target_size_ratio`` takes precedence and ``target_size_bytes`` is
+ignored.
+
+To reset ``target_size_bytes`` to zero::
+
+  ceph osd pool set <pool-name> target_size_bytes 0
+
+For more information, see :ref:`specifying_pool_target_size`.
+
 TOO_FEW_OSDS
 ____________
 
index cf7bf0cc4c2519f2b318fa53dd5dcc9ece2cc150..706f87d0e1bda8091f2b3dd10fa00529ba59fa9b 100755 (executable)
@@ -68,6 +68,11 @@ ceph osd pool set a target_size_ratio 0
 ceph osd pool set b target_size_ratio 0
 wait_for 60 "ceph health detail | grep POOL_TARGET_SIZE_BYTES_OVERCOMMITTED"
 
+ceph osd pool set a target_size_bytes 1000
+ceph osd pool set b target_size_bytes 1000
+ceph osd pool set a target_size_ratio 1
+wait_for 60 "ceph health detail | grep POOL_HAS_TARGET_SIZE_BYTES_AND_RATIO"
+
 ceph osd pool rm a a --yes-i-really-really-mean-it
 ceph osd pool rm b b --yes-i-really-really-mean-it
 
index 019b96f76db3e21be1f63d6ccf8055356ca2e156..0a973e9e2ca5d7c48b0ad49f29070d6eda759f7f 100644 (file)
@@ -394,6 +394,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)])
@@ -401,6 +402,9 @@ class PgAutoscaler(MgrModule):
         target_bytes_pools = dict([(r, []) for r in iter(root_map)])
 
         for p in ps:
+            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'])
@@ -484,5 +488,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)