]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: stop if we get a perfect score
authorSage Weil <sage@redhat.com>
Wed, 27 Sep 2017 19:12:36 +0000 (15:12 -0400)
committerSage Weil <sage@redhat.com>
Wed, 1 Nov 2017 12:28:49 +0000 (07:28 -0500)
..and fix the 'worse' threshold (we're just working around floating
point imprecision; 1.01 was too coarse).

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/balancer/module.py

index b576cb6b16eccb2d5963b62f5908b91189cd72b0..29f4b1d37f7c4e5bb41f1ac66e54148c0c26f81a 100644 (file)
@@ -693,13 +693,15 @@ class Module(MgrModule):
                 self.log.debug('Step misplaced %f > max %f, reducing step to %f',
                                next_misplaced, max_misplaced, step)
             else:
-                if next_pe.score > cur_pe.score * 1.01:
+                if next_pe.score > cur_pe.score * 1.0001:
                     step /= 2.0
                     self.log.debug('Score got worse, trying smaller step %f',
                                    step)
                 else:
                     cur_pe = next_pe
                     best_ws = next_ws
+                    if cur_pe.score == 0:
+                        break
             left -= 1
 
         if cur_pe.score < pe.score: