From: John Spray Date: Mon, 23 Apr 2018 21:09:37 +0000 (-0400) Subject: mgr: execute modules even if can_run=false X-Git-Tag: v13.1.0~132^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cf5ef59bcc435371c9f1a8ccc784792a9388a5fe;p=ceph.git mgr: execute modules even if can_run=false We execute modules even if can_run=false, so that it is possible to load them for running their selftest hooks. However, we already raise health messages about the fact that they're enabled but can't run, so we don't want to also raise health messages about whatever exceptions they raise from serve() Signed-off-by: John Spray --- diff --git a/src/mgr/PyModuleRegistry.cc b/src/mgr/PyModuleRegistry.cc index 2364b1cfb8b7..bd05a68ed737 100644 --- a/src/mgr/PyModuleRegistry.cc +++ b/src/mgr/PyModuleRegistry.cc @@ -195,7 +195,7 @@ void PyModuleRegistry::active_start( for (const auto &i : modules) { // Anything we're skipping because of !can_run will be flagged // to the user separately via get_health_checks - if (!(i.second->is_enabled() && i.second->get_can_run())) { + if (!(i.second->is_enabled() && i.second->is_loaded())) { continue; } @@ -353,7 +353,13 @@ void PyModuleRegistry::get_health_checks(health_check_map_t *checks) if (module->is_enabled() && !module->get_can_run()) { dependency_modules[module->get_name()] = module->get_error_string(); } else if ((module->is_enabled() && !module->is_loaded()) - || module->is_failed()) { + || (module->is_failed() && module->get_can_run())) { + // - Unloadable modules are only reported if they're enabled, + // to avoid spamming users about modules they don't have the + // dependencies installed for because they don't use it. + // - Failed modules are only reported if they passed the can_run + // checks (to avoid outputting two health messages about a + // module that said can_run=false but we tried running it anyway) failed_modules[module->get_name()] = module->get_error_string(); } }