]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: change config_prefix to be 'mgr/<id>/' and separate handle/key by '/'
authorDan Mick <dan.mick@redhat.com>
Thu, 4 May 2017 21:19:35 +0000 (14:19 -0700)
committerDan Mick <dan.mick@redhat.com>
Fri, 19 May 2017 05:09:08 +0000 (22:09 -0700)
dm_crypt config-key usage has established '/' as the separator; keep
that as a convention for now

Signed-off-by: Dan Mick <dan.mick@redhat.com>
src/mgr/PyModules.cc
src/mgr/PyModules.h

index 8b0fc62d373f99bb6fd0973a4bf28aaa6c09d673..10f4ce4787d2db9365daab8daacebf743484200d 100644 (file)
@@ -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/<id>/"
+  config_prefix = std::string(g_conf->name.get_type_str()) + "/" +
+                 g_conf->name.get_id() + "/";
 
   // Set up global python interpreter
   Py_SetProgramName(const_cast<char*>(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;
   {
index 8e929113053554500fa257eb7f5234f25d5c8324..c68366f2a17677a5dd58b831c501cd433d9a5e03 100644 (file)
@@ -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_,