]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/pg_autoscaler: define options using Option
authorKefu Chai <kchai@redhat.com>
Mon, 28 Jun 2021 03:34:09 +0000 (11:34 +0800)
committerKamoltat <ksirivad@redhat.com>
Thu, 26 Aug 2021 19:56:44 +0000 (19:56 +0000)
more consistent and less error-prune this way.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit b40de19c23b6b49f8d63bb3911bdebe9a2e19255)

src/pybind/mgr/pg_autoscaler/module.py

index e2948ea57a2d5624deb6384859c9736173ca6caa..cf325ae03a346782e5c74c12d9a5263a3630491a 100644 (file)
@@ -108,10 +108,10 @@ class PgAutoscaler(MgrModule):
     ]
 
     MODULE_OPTIONS = [
-        {
-            'name': 'sleep_interval',
-            'default': str(60),
-        },
+        Option(
+            name='sleep_interval',
+            type='secs',
+            default=60),
         Option(
             'autoscale_profile',
             default='scale-up',
@@ -244,7 +244,7 @@ class PgAutoscaler(MgrModule):
         while not self._shutdown.is_set():
             self._maybe_adjust()
             self._update_progress_events()
-            self._shutdown.wait(timeout=int(self.sleep_interval))
+            self._shutdown.wait(timeout=self.sleep_interval)
 
     def shutdown(self):
         self.log.info('Stopping pg_autoscaler')