]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/mgr/PyModuleRegistry.cc
import ceph nautilus 14.2.2
[ceph.git] / ceph / src / mgr / PyModuleRegistry.cc
index 785b5d3ab45191aa9a4a4d0125da418044e26d9e..061a92c6c7cc9c1843595bad3804aa86305637a8 100644 (file)
@@ -66,7 +66,8 @@ void PyModuleRegistry::init()
 
   std::list<std::string> failed_modules;
 
-  std::set<std::string> module_names = probe_modules();
+  const std::string module_path = g_conf().get_val<std::string>("mgr_module_path");
+  std::set<std::string> module_names = probe_modules(module_path);
   // Load python code
   for (const auto& module_name : module_names) {
     dout(1) << "Loading python module '" << module_name << "'" << dendl;
@@ -88,7 +89,9 @@ void PyModuleRegistry::init()
     // report its loading error
     modules[module_name] = std::move(mod);
   }
-
+  if (module_names.empty()) {
+    clog->error() << "No ceph-mgr modules found in " << module_path;
+  }
   if (!failed_modules.empty()) {
     clog->error() << "Failed to load ceph-mgr modules: " << joinify(
         failed_modules.begin(), failed_modules.end(), std::string(", "));
@@ -255,10 +258,8 @@ void PyModuleRegistry::shutdown()
   Py_Finalize();
 }
 
-std::set<std::string> PyModuleRegistry::probe_modules() const
+std::set<std::string> PyModuleRegistry::probe_modules(const std::string &path) const
 {
-  std::string path = g_conf().get_val<std::string>("mgr_module_path");
-
   DIR *dir = opendir(path.c_str());
   if (!dir) {
     return {};