From 96b9564f99f152542c5cea230eaf4292ca2b6548 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 9 Jul 2024 14:20:55 -0400 Subject: [PATCH] pybind/mgr: add a specific exception for the mgr_pool disabled case This can help avoid confusion when debugging why the mgr_pool was not available. Signed-off-by: John Mulligan --- src/pybind/mgr/mgr_module.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 1d62d978d0d..29ddff2ffc2 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -191,6 +191,13 @@ class MgrDBNotReady(RuntimeError): pass +class MgrDBNotAllowed(MgrDBNotReady): + """A more specific subclass of MgrDBNotReady raised when mgr_pool option + disabled. + """ + pass + + class OSDMap(ceph_module.BasePyOSDMap): def get_epoch(self) -> int: return self._get_epoch() @@ -1357,7 +1364,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): return self._db db_allowed = self.get_ceph_option("mgr_pool") if not db_allowed: - raise MgrDBNotReady() + raise MgrDBNotAllowed() self._db = self.open_db() if self._db is None: raise MgrDBNotReady() -- 2.39.5