]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: remove type conversions for ceph native options
authorSage Weil <sage@redhat.com>
Fri, 23 Aug 2019 17:15:01 +0000 (12:15 -0500)
committerSage Weil <sage@redhat.com>
Tue, 3 Sep 2019 15:32:00 +0000 (10:32 -0500)
We now return the correct Py types, just like we do for module options.

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

index 7868cd2fbc174e3f48265944961c768d27962cb2..8b9cc63e13dee1d0916df48514cc03a7a0ab134d 100644 (file)
@@ -856,7 +856,7 @@ class Module(MgrModule):
     def optimize(self, plan):
         self.log.info('Optimize plan %s' % plan.name)
         plan.mode = self.get_module_option('mode')
-        max_misplaced = float(self.get_ceph_option('target_max_misplaced_ratio'))
+        max_misplaced = self.get_ceph_option('target_max_misplaced_ratio')
         self.log.info('Mode %s, max misplaced %f' %
                       (plan.mode, max_misplaced))
 
@@ -957,7 +957,7 @@ class Module(MgrModule):
         step = self.get_module_option('crush_compat_step')
         if step <= 0 or step >= 1.0:
             return -errno.EINVAL, '"crush_compat_step" must be in (0, 1)'
-        max_misplaced = float(self.get_ceph_option('target_max_misplaced_ratio'))
+        max_misplaced = self.get_ceph_option('target_max_misplaced_ratio')
         min_pg_per_osd = 2
 
         ms = plan.initial
index 480b61c0ea22465f92fee4ce8a1f18a675fedd07..469173b21e9cd8d6fc0d0ee05a39574070c06b84 100644 (file)
@@ -132,7 +132,7 @@ class Hello(MgrModule):
             # Use mgr_tick_period (default: 2) here just to illustrate
             # consuming native ceph options.  Any real background work
             # would presumably have some more appropriate frequency.
-            sleep_interval = int(self.mgr_tick_period)
+            sleep_interval = self.mgr_tick_period
             self.log.debug('Sleeping for %d seconds', sleep_interval)
             ret = self.event.wait(sleep_interval)
             self.event.clear()
index 6c88e4a3a0497cc881126c5d47ad113c9567fe3c..1e8919f67bb3dfd2c43a1f46f507e6c5ea799b1a 100644 (file)
@@ -214,7 +214,7 @@ class PgAutoscaler(MgrModule):
         all_stats = self.get('osd_stats')
         for s in roots:
             s.osd_count = len(s.osds)
-            s.pg_target = s.osd_count * int(self.mon_target_pg_per_osd)
+            s.pg_target = s.osd_count * self.mon_target_pg_per_osd
 
             capacity = 0.0
             for osd_stats in all_stats['osd_stats']:
index 32673c8d8c1e1959f21bcd04b3f81c22caca185c..8e2dddc50cb194cf9c4eae45d8e98d12803928d5 100644 (file)
@@ -161,7 +161,7 @@ class PerfHandler:
                     self.process_raw_osd_perf_counters()
                     self.refresh_condition.notify()
 
-                    stats_period = int(self.module.get_ceph_option("mgr_stats_period"))
+                    stats_period = self.module.get_ceph_option("mgr_stats_period")
                     self.query_condition.wait(stats_period)
 
                 self.log.debug("PerfHandler: tick")