From dc15cd6075a8804f310ccfd9373c1e4c48acc093 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Thu, 4 May 2017 14:19:35 -0700 Subject: [PATCH] mgr: change config_prefix to be 'mgr//' and separate handle/key by '/' dm_crypt config-key usage has established '/' as the separator; keep that as a convention for now Signed-off-by: Dan Mick --- src/mgr/PyModules.cc | 10 ++++++++-- src/mgr/PyModules.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mgr/PyModules.cc b/src/mgr/PyModules.cc index 8b0fc62d373f9..10f4ce4787d2d 100644 --- a/src/mgr/PyModules.cc +++ b/src/mgr/PyModules.cc @@ -33,6 +33,9 @@ #undef dout_prefix #define dout_prefix *_dout << "mgr[py] " +// definition for non-const static member +std::string PyModules::config_prefix; + namespace { PyObject* log_write(PyObject*, PyObject* args) { char* m = nullptr; @@ -362,6 +365,9 @@ int PyModules::init() Mutex::Locker locker(lock); global_handle = this; + // namespace in config-key prefixed by "mgr//" + config_prefix = std::string(g_conf->name.get_type_str()) + "/" + + g_conf->name.get_id() + "/"; // Set up global python interpreter Py_SetProgramName(const_cast(PYTHON_EXECUTABLE)); @@ -542,7 +548,7 @@ bool PyModules::get_config(const std::string &handle, Mutex::Locker l(lock); PyEval_RestoreThread(tstate); - const std::string global_key = config_prefix + handle + "." + key; + const std::string global_key = config_prefix + handle + "/" + key; dout(4) << __func__ << "key: " << global_key << dendl; @@ -557,7 +563,7 @@ bool PyModules::get_config(const std::string &handle, void PyModules::set_config(const std::string &handle, const std::string &key, const std::string &val) { - const std::string global_key = config_prefix + handle + "." + key; + const std::string global_key = config_prefix + handle + "/" + key; Command set_cmd; { diff --git a/src/mgr/PyModules.h b/src/mgr/PyModules.h index 8e92911305355..c68366f2a1767 100644 --- a/src/mgr/PyModules.h +++ b/src/mgr/PyModules.h @@ -44,7 +44,7 @@ class PyModules std::string get_site_packages(); public: - static constexpr auto config_prefix = "mgr."; + static std::string config_prefix; PyModules(DaemonStateIndex &ds, ClusterState &cs, MonClient &mc, Objecter &objecter_, Client &client_, -- 2.39.5