]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: ignore modules that fail to instantiate
authorNoah Watkins <nwatkins@redhat.com>
Sun, 15 Jul 2018 20:02:58 +0000 (13:02 -0700)
committerNoah Watkins <nwatkins@redhat.com>
Tue, 24 Jul 2018 15:41:46 +0000 (08:41 -0700)
If an uncaught runtime exception occurs in a module constructor, then
the manager still tries to deliver notifications resulting in errors
like:

src/mgr/ActivePyModule.cc: 54: FAILED assert(pClassInstance != nullptr)

This removes the failed module from the set of active modules that
should receive command and notifications.

This also serves as a basis for accurately determining if the manager
satisifes all "always on" module constraints.

Signed-off-by: Noah Watkins <nwatkins@redhat.com>
src/mgr/ActivePyModules.cc

index 46a0f0a6c753717bf13f3b24b04ec57fbd0f28ef..8ffa7fe2ea66155f0d4b362da6c9ee64bbda4256 100644 (file)
@@ -386,6 +386,9 @@ int ActivePyModules::start_one(PyModuleRef py_module)
 
   int r = active_module->load(this);
   if (r != 0) {
+    // the class instance wasn't created... remove it from the set of activated
+    // modules so commands and notifications aren't delivered.
+    modules.erase(py_module->get_name());
     return r;
   } else {
     dout(4) << "Starting thread for " << py_module->get_name() << dendl;