]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
pybind/mgr/balancer: sanity check against empty roots
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 7 Mar 2018 05:56:17 +0000 (13:56 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 8 Mar 2018 01:05:58 +0000 (09:05 +0800)
commit1e3498ad9116d696a72ceb65d9f882b2c1970cd5
treebe7d01827cb113ee2f3a05d2ebff1c10c1e32b3d
parent193c3af4fb0cfd73f1495ba1389d6a577cb2ce58
pybind/mgr/balancer: sanity check against empty roots

To avoid crashes as below:
```
File "/usr/lib/ceph/mgr/balancer/module.py", line 181, in calc_stats
    score += target[k] * (math.erf(((adjusted - avg)/avg) / math.sqrt(2.0)))
ZeroDivisionError: float division by zero
```

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/pybind/mgr/balancer/module.py