From 0bcaa261510f5bf2c69f2fe411ea3e2efe37ba60 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Wed, 11 Mar 2020 15:03:12 +0000 Subject: [PATCH] mgr/rbd_support: attempt to unregister watcher on mgr exit Signed-off-by: Mykola Golub --- src/pybind/mgr/mgr_module.py | 4 ++++ src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index d6ba31f720862..7d3aaf3d2d515 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -599,8 +599,12 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule, MgrModuleLoggingMixin): self._logger = self.getLogger() def __del__(self): + self._cleanup() self._unconfigure_logging() + def _cleanup(self): + pass + @classmethod def _register_options(cls, module_name): cls.MODULE_OPTIONS.append( diff --git a/src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py b/src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py index fc7a7d986b21a..e9cde79b6e205 100644 --- a/src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py +++ b/src/pybind/mgr/rbd_support/mirror_snapshot_schedule.py @@ -162,6 +162,9 @@ class MirrorSnapshotScheduleHandler: self.thread = Thread(target=self.run) self.thread.start() + def _cleanup(self): + self.watchers.unregister_all() + def run(self): try: self.log.info("MirrorSnapshotScheduleHandler: starting") -- 2.39.5