]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/balancer/module.py: add max/min info in stats_by_root 30432/head
authorYang Honggang <yanghonggang@umcloud.com>
Tue, 17 Sep 2019 15:30:30 +0000 (23:30 +0800)
committerYang Honggang <yanghonggang@umcloud.com>
Thu, 19 Sep 2019 06:00:24 +0000 (14:00 +0800)
$ ceph balancer eval-verbose hahapool
...
count_by_pool {'hahapool': {'objects': {0: 1L, 1: 1L, 2: 0L, 3: 0L, 4: 1L}, 'bytes': {0: 0L, 1: 0L, 2: 0L, 3: 0L, 4: 0L}, 'pgs': {0: 35, 1: 42, 2: 23, 3: 30, 4: 26}}}
...
stats_by_root {'default': {'objects': {'min': 0.0, 'max': 1.0, 'score': 0.2970089549436925, 'stddev': 0.5477225575051662, 'avg': 0.6, 'sum_weight': 0.6000000000000001}, 'bytes': {'min': 0, 'max': 0, 'score': 0, 'stddev': 0, 'avg': 0, 'sum_weight': 0}, 'pgs': {'min': 23.0, 'max': 42.0, 'score': 0.07354228523075643, 'stddev': 7.52994023880668, 'avg': 31.2, 'sum_weight': 0.4}}}

max/min can give us an intuitive feel of the pg/bytes/object's distribution.
In addition, sometimes we really want to know which osd hold the most
number of pgs/bytes/objects for specified pool.

Signed-off-by: Yang Honggang <yanghonggang@umcloud.com>
src/pybind/mgr/balancer/module.py

index 8b9cc63e13dee1d0916df48514cc03a7a0ab134d..758aadd5721d0cc016f2ed68ee26041c1acfb6bd 100644 (file)
@@ -141,6 +141,8 @@ class Eval:
         for t in ('pgs', 'objects', 'bytes'):
             if total[t] == 0:
                 r[t] = {
+                    'max': 0,
+                    'min': 0,
                     'avg': 0,
                     'stddev': 0,
                     'sum_weight': 0,
@@ -189,6 +191,8 @@ class Eval:
             stddev = math.sqrt(dev / float(max(num - 1, 1)))
             score = score / max(sum_weight, 1)
             r[t] = {
+                'max': max(count[t].values()),
+                'min': min(count[t].values()),
                 'avg': avg,
                 'stddev': stddev,
                 'sum_weight': sum_weight,