mirror of
https://github.com/ceph/ceph
synced 2024-12-26 21:43:10 +00:00
pybind/mgr/balancer: allow customized optimization threshold
In practice it is hard to achieve a 100% (perfect) balanced distribution. This patch introduces a user visiable threshold configuration here, which allow user to define the minimal deviation to trigger an optimization. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
3733b94686
commit
147625651f
@ -697,8 +697,13 @@ class Module(MgrModule):
|
||||
osdmap = ms.osdmap
|
||||
crush = osdmap.get_crush()
|
||||
pe = self.calc_eval(ms, plan.pools)
|
||||
if pe.score == 0:
|
||||
detail = 'Distribution is already perfect'
|
||||
min_score_to_optimize = float(self.get_config('min_score', 0))
|
||||
if pe.score <= min_score_to_optimize:
|
||||
if pe.score == 0:
|
||||
detail = 'Distribution is already perfect'
|
||||
else:
|
||||
detail = 'score %f <= min_score %f, will not optimize' \
|
||||
% (pe.score, min_score_to_optimize)
|
||||
self.log.info(detail)
|
||||
return -errno.EALREADY, detail
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user