]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/balancer: cast config vals to int or float 19553/head
authorDan van der Ster <daniel.vanderster@cern.ch>
Wed, 13 Dec 2017 16:02:44 +0000 (17:02 +0100)
committerShinobu Kinjo <shinobu@redhat.com>
Fri, 15 Dec 2017 20:20:23 +0000 (05:20 +0900)
upmap_max_iterations and other config vals need to be numeric.
Cast them appropriately.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
Fixes: http://tracker.ceph.com/issues/22429
(cherry picked from commit d7713e6f823dd62a33a27996e1da8e29f3f7b7c5)

src/pybind/mgr/balancer/module.py

index b8cc087b9e8b8edaf446e999e82902e934165370..3559fbcfbecebafdc6924a42bfdf4637056607df 100644 (file)
@@ -604,8 +604,8 @@ class Module(MgrModule):
 
     def do_upmap(self, plan):
         self.log.info('do_upmap')
-        max_iterations = self.get_config('upmap_max_iterations', 10)
-        max_deviation = self.get_config('upmap_max_deviation', .01)
+        max_iterations = int(self.get_config('upmap_max_iterations', 10))
+        max_deviation = float(self.get_config('upmap_max_deviation', .01))
 
         ms = plan.initial
         pools = [str(i['pool_name']) for i in ms.osdmap_dump.get('pools',[])]
@@ -630,10 +630,10 @@ class Module(MgrModule):
 
     def do_crush_compat(self, plan):
         self.log.info('do_crush_compat')
-        max_iterations = self.get_config('crush_compat_max_iterations', 25)
+        max_iterations = int(self.get_config('crush_compat_max_iterations', 25))
         if max_iterations < 1:
             return False
-        step = self.get_config('crush_compat_step', .5)
+        step = float(self.get_config('crush_compat_step', .5))
         if step <= 0 or step >= 1.0:
             return False
         max_misplaced = float(self.get_config('max_misplaced',