From: Mykola Golub Date: Wed, 11 Mar 2020 15:03:12 +0000 (+0000) Subject: mgr/rbd_support: attempt to unregister watcher on mgr exit X-Git-Tag: v15.2.10~36^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=655693a91059e410d51be417231c2257a518f2bc;p=ceph.git mgr/rbd_support: attempt to unregister watcher on mgr exit Signed-off-by: Mykola Golub (cherry picked from commit 0bcaa261510f5bf2c69f2fe411ea3e2efe37ba60) --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 6f3e79918772..937cf5c30f87 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -609,8 +609,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 fc7a7d986b21..e9cde79b6e20 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")