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: v12.2.5~81^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e50a50cf10dc4abd2af385840db104285dbffebc;p=ceph.git pybind/mgr/balancer: cancel plan if distribution is already perfect Signed-off-by: xie xingguo (cherry picked from commit 3da5257a675e966e9b5748dc35373fc078c61a87) --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 2a14dcae7f2..bf8d1143c8e 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):