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-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20305%2Fhead;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 a07ae853825..faf5cfd1c50 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):