From: xie xingguo Date: Fri, 2 Feb 2018 07:24:21 +0000 (+0800) Subject: pybind/mgr/balancer: cancel plan if distribution is already perfect X-Git-Tag: v13.0.2~322^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3da5257a675e966e9b5748dc35373fc078c61a87;p=ceph.git pybind/mgr/balancer: cancel plan if distribution is already perfect Signed-off-by: xie xingguo --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index a07ae8538257d..faf5cfd1c509f 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -679,6 +679,9 @@ class Module(MgrModule): if left <= 0: break self.log.info('prepared %d/%d changes' % (total_did, max_iterations)) + if total_did == 0: + return -errno.EALREADY, 'Unable to find further optimization,' \ + 'or distribution is already perfect' return 0, '' def do_crush_compat(self, plan):