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: v16.1.0~2606^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33806%2Fhead;p=ceph.git mgr/rbd_support: attempt to unregister watcher on mgr exit Signed-off-by: Mykola Golub --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index d6ba31f72086..7d3aaf3d2d51 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 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")