]> git.apps.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)
committerKefu Chai <kchai@redhat.com>
Mon, 10 Feb 2020 02:08:36 +0000 (10:08 +0800)
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
doc/rados/operations/health-checks.rst
qa/workunits/mon/pg_autoscaler.sh
src/pybind/mgr/pg_autoscaler/module.py

index 85eeea9afc0c5002ddf0f2b5cea8319127a7c675..bd71a2ee937f8c8918d8842ed7183868866d84d6 100644 (file)
@@ -848,6 +848,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 12b1e13ffa9dad64d4b91d7037132ac5e422a256..62e29464e0c816f5480981a5e19e8ea75b2c3205 100644 (file)
@@ -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)