]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: cluster log message on plugin load error
authorJohn Spray <john.spray@redhat.com>
Sun, 25 Jun 2017 16:08:37 +0000 (12:08 -0400)
committerJohn Spray <john.spray@redhat.com>
Tue, 27 Jun 2017 09:59:07 +0000 (10:59 +0100)
To make it a bit more obvious what's going on, otherwise
user's first sign is when they try and use a CLI bit
and get a command not found.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/Mgr.cc
src/mgr/PyModules.cc
src/mgr/PyModules.h

index 15fae8502e2c190b4b0054f9629183ffd2b3b7d8..cd21408efa30226d3cb0b136e668e08a8a836393 100644 (file)
@@ -48,7 +48,7 @@ Mgr::Mgr(MonClient *monc_, Messenger *clientm_, Objecter *objecter_,
   lock("Mgr::lock"),
   timer(g_ceph_context, lock),
   finisher(g_ceph_context, "Mgr", "mgr-fin"),
-  py_modules(daemon_state, cluster_state, *monc, *objecter, *client,
+  py_modules(daemon_state, cluster_state, *monc, clog_, *objecter, *client,
              finisher),
   cluster_state(monc, nullptr),
   server(monc, finisher, daemon_state, cluster_state, py_modules,
index 988e16ba608039f1ec15cbed311da129f40e5f1b..6d5788a303305bd23a30b0251e9be385801967ae 100644 (file)
@@ -40,9 +40,9 @@ std::string PyModules::config_prefix;
 // because ServeThread is still an "incomplete" type there
 
 PyModules::PyModules(DaemonStateIndex &ds, ClusterState &cs,
-         MonClient &mc, Objecter &objecter_, Client &client_,
-         Finisher &f)
-  : daemon_state(ds), cluster_state(cs), monc(mc),
+         MonClient &mc, LogChannelRef clog_, Objecter &objecter_,
+          Client &client_, Finisher &f)
+  : daemon_state(ds), cluster_state(cs), monc(mc), clog(clog_),
     objecter(objecter_), client(client_), finisher(f),
     lock("PyModules")
 {}
@@ -360,6 +360,8 @@ int PyModules::init()
   // thread state becomes NULL)
   pMainThreadState = PyEval_SaveThread();
 
+  std::list<std::string> failed_modules;
+
   // Load python code
   boost::tokenizer<> tok(g_conf->mgr_modules);
   for(const auto& module_name : tok) {
@@ -371,6 +373,7 @@ int PyModules::init()
       // or the right thread state (this is deliberate).
       derr << "Error loading module '" << module_name << "': "
         << cpp_strerror(r) << dendl;
+      failed_modules.push_back(module_name);
       // Don't drop out here, load the other modules
     } else {
       // Success!
@@ -378,6 +381,11 @@ int PyModules::init()
     }
   }
 
+  if (!failed_modules.empty()) {
+    clog->error() << "Failed to load ceph-mgr modules: " << joinify(
+        failed_modules.begin(), failed_modules.end(), std::string(", "));
+  }
+
   return 0;
 }
 
index 6a71b64933116fca5fa12c88ae96950048a362ed..c98f7694bf64a94c2baf551995bc7577171be73b 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "osdc/Objecter.h"
 #include "client/Client.h"
+#include "common/LogClient.h"
 
 #include "DaemonState.h"
 #include "ClusterState.h"
@@ -35,6 +36,7 @@ class PyModules
   DaemonStateIndex &daemon_state;
   ClusterState &cluster_state;
   MonClient &monc;
+  LogChannelRef clog;
   Objecter &objecter;
   Client   &client;
   Finisher &finisher;
@@ -49,7 +51,7 @@ public:
   static std::string config_prefix;
 
   PyModules(DaemonStateIndex &ds, ClusterState &cs, MonClient &mc,
-            Objecter &objecter_, Client &client_,
+            LogChannelRef clog_, Objecter &objecter_, Client &client_,
             Finisher &f);
 
   ~PyModules();