From: Yang Honggang Date: Tue, 17 Sep 2019 15:30:30 +0000 (+0800) Subject: pybind/mgr/balancer/module.py: add max/min info in stats_by_root X-Git-Tag: v15.1.0~1468^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F30432%2Fhead;p=ceph.git pybind/mgr/balancer/module.py: add max/min info in stats_by_root $ 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 --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 8b9cc63e13de..758aadd5721d 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -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,