]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: rename internal get_config -> get_module_option
authorSage Weil <sage@redhat.com>
Tue, 4 Dec 2018 23:22:23 +0000 (17:22 -0600)
committerSage Weil <sage@redhat.com>
Mon, 10 Dec 2018 18:11:44 +0000 (12:11 -0600)
The python module interface doesn't change (yet).

Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/BaseMgrModule.cc
src/mgr/BaseMgrStandbyModule.cc
src/pybind/mgr/mgr_module.py

index 7a86298c45ec58933721d2c0936d822cc8c75b4b..2833e27766218b103414767d5441f873a9fb2a68 100644 (file)
@@ -380,16 +380,16 @@ ceph_option_get(BaseMgrModule *self, PyObject *args)
     dout(10) << "ceph_option_get " << what << " found: " << value << dendl;
     return PyString_FromString(value.c_str());
   } else {
-    dout(4) << "ceph_config_get " << what << " not found " << dendl;
+    dout(4) << "ceph_option_get " << what << " not found " << dendl;
     Py_RETURN_NONE;
   }
 }
 
 static PyObject*
-ceph_config_get(BaseMgrModule *self, PyObject *args)
+ceph_get_module_option(BaseMgrModule *self, PyObject *args)
 {
   char *what = nullptr;
-  if (!PyArg_ParseTuple(args, "s:ceph_config_get", &what)) {
+  if (!PyArg_ParseTuple(args, "s:ceph_get_module_option", &what)) {
     derr << "Invalid args!" << dendl;
     return nullptr;
   }
@@ -398,10 +398,10 @@ ceph_config_get(BaseMgrModule *self, PyObject *args)
   bool found = self->py_modules->get_config(self->this_module->get_name(),
       what, &value);
   if (found) {
-    dout(10) << "ceph_config_get " << what << " found: " << value.c_str() << dendl;
+    dout(10) << __func__ << " " << what << " found: " << value.c_str() << dendl;
     return PyString_FromString(value.c_str());
   } else {
-    dout(4) << "ceph_config_get " << what << " not found " << dendl;
+    dout(4) << __func__ << " " << what << " not found " << dendl;
     Py_RETURN_NONE;
   }
 }
@@ -959,10 +959,10 @@ PyMethodDef BaseMgrModule_methods[] = {
    "Get the name of the Mgr daemon where we are running"},
 
   {"_ceph_get_option", (PyCFunction)ceph_option_get, METH_VARARGS,
-   "Get a configuration option value"},
+   "Get a native configuration option value"},
 
-  {"_ceph_get_config", (PyCFunction)ceph_config_get, METH_VARARGS,
-   "Get a configuration value"},
+  {"_ceph_get_module_option", (PyCFunction)ceph_get_module_option, METH_VARARGS,
+   "Get a module configuration option value"},
 
   {"_ceph_get_store_prefix", (PyCFunction)ceph_store_get_prefix, METH_VARARGS,
    "Get all KV store values with a given prefix"},
index db980a2bcc541a2286a3a3d7a4f2db40dc18f87d..088bb91838d8c67ae44e2c53645d0cfdbff34446 100644 (file)
@@ -61,10 +61,10 @@ ceph_get_mgr_id(BaseMgrStandbyModule *self, PyObject *args)
 }
 
 static PyObject*
-ceph_config_get(BaseMgrStandbyModule *self, PyObject *args)
+ceph_get_module_option(BaseMgrStandbyModule *self, PyObject *args)
 {
   char *what = nullptr;
-  if (!PyArg_ParseTuple(args, "s:ceph_config_get", &what)) {
+  if (!PyArg_ParseTuple(args, "s:ceph_get_module_option", &what)) {
     derr << "Invalid args!" << dendl;
     return nullptr;
   }
@@ -72,10 +72,10 @@ ceph_config_get(BaseMgrStandbyModule *self, PyObject *args)
   std::string value;
   bool found = self->this_module->get_config(what, &value);
   if (found) {
-    dout(10) << "ceph_config_get " << what << " found: " << value.c_str() << dendl;
+    dout(10) << __func__ << " " << what << " found: " << value.c_str() << dendl;
     return PyString_FromString(value.c_str());
   } else {
-    dout(4) << "ceph_config_get " << what << " not found " << dendl;
+    dout(4) << __func__ << " " << what << " not found " << dendl;
     Py_RETURN_NONE;
   }
 }
@@ -133,7 +133,7 @@ PyMethodDef BaseMgrStandbyModule_methods[] = {
   {"_ceph_get_mgr_id", (PyCFunction)ceph_get_mgr_id, METH_NOARGS,
    "Get the name of the Mgr daemon where we are running"},
 
-  {"_ceph_get_config", (PyCFunction)ceph_config_get, METH_VARARGS,
+  {"_ceph_get_module_option", (PyCFunction)ceph_get_module_option, METH_VARARGS,
    "Get a configuration value"},
 
   {"_ceph_get_store", (PyCFunction)ceph_store_get, METH_VARARGS,
index 221a02d234607be1fc500277c4f0b538a31cb119..c71e019bfea4d92195d250dbe4dd538980e7a0e2 100644 (file)
@@ -240,7 +240,7 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule):
         :param default: the default value of the config if it is not found
         :return: str
         """
-        r = self._ceph_get_config(key)
+        r = self._ceph_get_module_option(key)
         if r is None:
             return default
         else:
@@ -678,7 +678,7 @@ class MgrModule(ceph_module.BaseMgrModule):
     def get_option(self, key):
         return self._ceph_get_option(key)
 
-    def _validate_option(self, key):
+    def _validate_module_option(self, key):
         """
         Helper: don't allow get/set config callers to 
         access config options that they didn't declare
@@ -688,8 +688,8 @@ class MgrModule(ceph_module.BaseMgrModule):
             raise RuntimeError("Config option '{0}' is not in {1}.MODULE_OPTIONS".\
                     format(key, self.__class__.__name__))
 
-    def _get_config(self, key, default):
-        r = self._ceph_get_config(key)
+    def _get_module_option(self, key, default):
+        r = self._ceph_get_module_option(key)
         if r is None:
             return default
         else:
@@ -702,8 +702,8 @@ class MgrModule(ceph_module.BaseMgrModule):
         :param str key:
         :return: str
         """
-        self._validate_option(key)
-        return self._get_config(key, default)
+        self._validate_module_option(key)
+        return self._get_module_option(key, default)
 
     def get_store_prefix(self, key_prefix):
         """
@@ -732,8 +732,8 @@ class MgrModule(ceph_module.BaseMgrModule):
         :param str default:
         :return: str
         """
-        self._validate_option(key)
-        return self._get_localized(key, default, self._get_config)
+        self._validate_module_option(key)
+        return self._get_localized(key, default, self._get_module_option)
 
     def _set_config(self, key, val):
         return self._ceph_set_config(key, val)
@@ -745,7 +745,7 @@ class MgrModule(ceph_module.BaseMgrModule):
         :param str key:
         :param str val:
         """
-        self._validate_option(key)
+        self._validate_module_option(key)
         return self._set_config(key, val)
 
     def set_localized_config(self, key, val):
@@ -755,7 +755,7 @@ class MgrModule(ceph_module.BaseMgrModule):
         :param str default:
         :return: str
         """
-        self._validate_option(key)
+        self._validate_module_option(key)
         return self._set_localized(key, val, self._set_config)
 
     def set_store(self, key, val):