mgr: cluster log message on plugin load error

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>
This commit is contained in:
John Spray 2017-06-25 12:08:37 -04:00
parent 5977372715
commit 67bd8c40ed
3 changed files with 15 additions and 5 deletions

View 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,

View 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;
}

View 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();