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>
num = max(len(target), 1)
r = {}
for t in ('pgs', 'objects', 'bytes'):
+ if total[t] == 0:
+ r[t] = {
+ 'avg': 0,
+ 'stddev': 0,
+ 'sum_weight': 0,
+ 'score': 0,
+ }
+ continue
+
avg = float(total[t]) / float(num)
dev = 0.0