From 3da5257a675e966e9b5748dc35373fc078c61a87 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 2 Feb 2018 15:24:21 +0800 Subject: [PATCH] pybind/mgr/balancer: cancel plan if distribution is already perfect Signed-off-by: xie xingguo --- src/pybind/mgr/balancer/module.py | 3 +++ 1 file changed, 3 insertions(+) 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): -- 2.39.5