]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rbd_support: remove localized schedule option during module startup 49650/head
authorRamana Raja <rraja@redhat.com>
Wed, 14 Dec 2022 05:09:37 +0000 (00:09 -0500)
committerRamana Raja <rraja@redhat.com>
Thu, 5 Jan 2023 20:25:56 +0000 (15:25 -0500)
The localized schedule option was removed during every load of a
scheduler handler. This occured multiple times during a mgr process's
lifespan. Instead, remove the localized schedule module option when the
rbd_support module starts up.

Fixes: https://tracker.ceph.com/issues/57726
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit 377840a746e4d47b77e24648b06f53f4a52315c1)

Conflicts:
       src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py
       src/pybind/mgr/rbd_support/schedule.py
       src/pybind/mgr/rbd_support/trash_purge_schedule.py
 - Above conflicts were due to commit e4a16e2
   ("mgr/rbd_support: add type annotation") not in pacific

src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py
src/pybind/mgr/rbd_support/schedule.py
src/pybind/mgr/rbd_support/trash_purge_schedule.py

index 536ee3d16c9997fdfd4fa2cbb5cb7977c99cd557..af32a77aaad29efc8026e25ce16b6dac22b33599 100644 (file)
@@ -342,15 +342,13 @@ class MirrorSnapshotScheduleHandler:
     def init_schedule_queue(self):
         self.queue = {}
         self.images = {}
+        self.schedules = Schedules(self)
         self.refresh_images()
         self.log.debug("MirrorSnapshotScheduleHandler: queue is initialized")
 
     def load_schedules(self):
         self.log.info("MirrorSnapshotScheduleHandler: load_schedules")
-
-        schedules = Schedules(self)
-        schedules.load(namespace_validator, image_validator)
-        self.schedules = schedules
+        self.schedules.load(namespace_validator, image_validator)
 
     def refresh_images(self):
         elapsed = (datetime.now() - self.last_refresh_images).total_seconds()
index 3063a086a4117b7f37eb966b8bcbd642057496a1..167514bbbfa44bd8a815e6f58ad7cd7c4cde9732 100644 (file)
@@ -338,16 +338,10 @@ class Schedules:
         self.level_specs = {}
         self.schedules = {}
 
-    def __len__(self):
-        return len(self.schedules)
-
-    def load(self, namespace_validator=None, image_validator=None):
-
-        schedule_cfg = self.handler.module.get_module_option(
-            self.handler.MODULE_OPTION_NAME, '')
-
         # Previous versions incorrectly stored the global config in
         # the localized module option. Check the config is here and fix it.
+        schedule_cfg = self.handler.module.get_module_option(
+            self.handler.MODULE_OPTION_NAME, '')
         if not schedule_cfg:
             schedule_cfg = self.handler.module.get_localized_module_option(
                 self.handler.MODULE_OPTION_NAME, '')
@@ -357,6 +351,15 @@ class Schedules:
         self.handler.module.set_localized_module_option(
             self.handler.MODULE_OPTION_NAME, None)
 
+    def __len__(self):
+        return len(self.schedules)
+
+    def load(self, namespace_validator=None, image_validator=None):
+        self.level_specs = {}
+        self.schedules = {}
+
+        schedule_cfg = self.handler.module.get_module_option(
+            self.handler.MODULE_OPTION_NAME, '')
         if schedule_cfg:
             try:
                 level_spec = LevelSpec.make_global()
index bf5d8ae70815a5700c33a46a26f9876f7669721f..df6221f53fb3d68aa6985ab973dd78ca3f9441be 100644 (file)
@@ -63,15 +63,13 @@ class TrashPurgeScheduleHandler:
     def init_schedule_queue(self):
         self.queue = {}
         self.pools = {}
+        self.schedules = Schedules(self)
         self.refresh_pools()
         self.log.debug("TrashPurgeScheduleHandler: queue is initialized")
 
     def load_schedules(self):
         self.log.info("TrashPurgeScheduleHandler: load_schedules")
-
-        schedules = Schedules(self)
-        schedules.load()
-        self.schedules = schedules
+        self.schedules.load()
 
     def refresh_pools(self):
         elapsed = (datetime.now() - self.last_refresh_pools).total_seconds()