From: Sage Weil Date: Fri, 23 Aug 2019 17:15:01 +0000 (-0500) Subject: pybind/mgr: remove type conversions for ceph native options X-Git-Tag: v15.1.0~1660^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=32d4bfa732547a6d78f18786b0a379fb6f7e73d9;p=ceph-ci.git pybind/mgr: remove type conversions for ceph native options We now return the correct Py types, just like we do for module options. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 7868cd2fbc1..8b9cc63e13d 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -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 diff --git a/src/pybind/mgr/hello/module.py b/src/pybind/mgr/hello/module.py index 480b61c0ea2..469173b21e9 100644 --- a/src/pybind/mgr/hello/module.py +++ b/src/pybind/mgr/hello/module.py @@ -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() diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 6c88e4a3a04..1e8919f67bb 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -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']: diff --git a/src/pybind/mgr/rbd_support/module.py b/src/pybind/mgr/rbd_support/module.py index 32673c8d8c1..8e2dddc50cb 100644 --- a/src/pybind/mgr/rbd_support/module.py +++ b/src/pybind/mgr/rbd_support/module.py @@ -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")