Fixes: https://tracker.ceph.com/issues/35985
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit
d590a53)
Conflicts:
src/mgr/ActivePyModules.cc
bool ActivePyModules::get_config(const std::string &module_name,
const std::string &key, std::string *val) const
{
- PyThreadState *tstate = PyEval_SaveThread();
- Mutex::Locker l(lock);
- PyEval_RestoreThread(tstate);
-
const std::string global_key = PyModuleRegistry::config_prefix
+ module_name + "/" + key;
dout(4) << __func__ << "key: " << global_key << dendl;
+ Mutex::Locker l(lock);
+
if (config_cache.count(global_key)) {
*val = config_cache.at(global_key);
return true;
return nullptr;
}
+ PyThreadState *tstate = PyEval_SaveThread();
std::string value;
bool found = self->py_modules->get_config(self->this_module->get_name(),
what, &value);
+
+ PyEval_RestoreThread(tstate);
+
if (found) {
dout(10) << "ceph_config_get " << what << " found: " << value.c_str() << dendl;
return PyString_FromString(value.c_str());