]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: replace get_config_prefix with get_store_prefix
authorJohn Spray <john.spray@redhat.com>
Mon, 16 Apr 2018 09:39:44 +0000 (05:39 -0400)
committerJohn Spray <john.spray@redhat.com>
Mon, 23 Apr 2018 11:29:46 +0000 (07:29 -0400)
The _prefix variant was only used for data-ish things,
so we can just move it over to operate on store instead
of config, rather than having a _prefix variant for both.

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

index e61030ab686e3f98b18f3f465966f1085fe2c7ff..6df6cacffb6ecdf1ed1c30e64f5e47440fa202b6 100644 (file)
@@ -25,7 +25,6 @@
 #include "mgr/MgrContext.h"
 
 // For ::config_prefix
-#include "PyModuleRegistry.h"
 #include "PyModule.h"
 
 #include "ActivePyModules.h"
@@ -463,7 +462,7 @@ bool ActivePyModules::get_config(const std::string &module_name,
   }
 }
 
-PyObject *ActivePyModules::get_config_prefix(const std::string &module_name,
+PyObject *ActivePyModules::get_store_prefix(const std::string &module_name,
     const std::string &prefix) const
 {
   PyThreadState *tstate = PyEval_SaveThread();
@@ -479,8 +478,8 @@ PyObject *ActivePyModules::get_config_prefix(const std::string &module_name,
   
   Mutex::Locker lock(module_config.lock);
   
-  for (auto p = module_config.config.lower_bound(global_prefix);
-       p != module_config.config.end() && p->first.find(global_prefix) == 0;
+  for (auto p = store_cache.lower_bound(global_prefix);
+       p != store_cache.end() && p->first.find(global_prefix) == 0;
        ++p) {
     f.dump_string(p->first.c_str() + base_prefix.size(), p->second);
   }
index 69aaa5c9f07d3c1ccd4d4f47c73961a130953a86..c10a087c4e2cc2d2d236029f5ebcd6e79631ba8b 100644 (file)
@@ -77,7 +77,7 @@ public:
 
   bool get_store(const std::string &module_name,
       const std::string &key, std::string *val) const;
-  PyObject *get_config_prefix(const std::string &module_name,
+  PyObject *get_store_prefix(const std::string &module_name,
                              const std::string &prefix) const;
   void set_store(const std::string &module_name,
       const std::string &key, const boost::optional<std::string> &val);
index ce42bf09a1044e59b7cbcdf73e853d5f691601ee..5ff2aeebb7115a9ff7bb093f3af3a34f3a4c9493 100644 (file)
@@ -369,15 +369,15 @@ ceph_config_get(BaseMgrModule *self, PyObject *args)
 }
 
 static PyObject*
-ceph_config_get_prefix(BaseMgrModule *self, PyObject *args)
+ceph_store_get_prefix(BaseMgrModule *self, PyObject *args)
 {
   char *prefix = nullptr;
-  if (!PyArg_ParseTuple(args, "s:ceph_config_get", &prefix)) {
+  if (!PyArg_ParseTuple(args, "s:ceph_store_get_prefix", &prefix)) {
     derr << "Invalid args!" << dendl;
     return nullptr;
   }
 
-  return self->py_modules->get_config_prefix(self->this_module->get_name(),
+  return self->py_modules->get_store_prefix(self->this_module->get_name(),
       prefix);
 }
 
@@ -579,8 +579,8 @@ PyMethodDef BaseMgrModule_methods[] = {
   {"_ceph_get_config", (PyCFunction)ceph_config_get, METH_VARARGS,
    "Get a configuration value"},
 
-  {"_ceph_get_config_prefix", (PyCFunction)ceph_config_get_prefix, METH_VARARGS,
-   "Get all configuration values with a given prefix"},
+  {"_ceph_get_store_prefix", (PyCFunction)ceph_store_get_prefix, METH_VARARGS,
+   "Get all KV store values with a given prefix"},
 
   {"_ceph_set_config", (PyCFunction)ceph_config_set, METH_VARARGS,
    "Set a configuration value"},