}
static PyObject*
-ceph_get_module_option_ex(BaseMgrModule *self, PyObject *args)
+ceph_get_module_option(BaseMgrModule *self, PyObject *args)
{
char *module = nullptr;
char *key = nullptr;
- if (!PyArg_ParseTuple(args, "ss:ceph_get_module_option_ex", &module, &key)) {
+ if (!PyArg_ParseTuple(args, "ss:ceph_get_module_option", &module, &key)) {
derr << "Invalid args!" << dendl;
return nullptr;
}
return pResult;
}
-static PyObject*
-ceph_get_module_option(BaseMgrModule *self, PyObject *args)
-{
- char *key = nullptr;
- if (!PyArg_ParseTuple(args, "s:ceph_get_module_option", &key)) {
- derr << "Invalid args!" << dendl;
- return nullptr;
- }
-
- PyThreadState *tstate = PyEval_SaveThread();
- std::string value;
- bool found = self->py_modules->get_config(self->this_module->get_name(),
- key, &value);
- PyEval_RestoreThread(tstate);
-
- if (found) {
- dout(10) << __func__ << " " << key << " found: " << value.c_str() << dendl;
- return self->this_module->py_module->get_typed_option_value(key, value);
- } else {
- dout(4) << __func__ << " " << key << " not found " << dendl;
- Py_RETURN_NONE;
- }
-}
-
static PyObject*
ceph_store_get_prefix(BaseMgrModule *self, PyObject *args)
{
}
static PyObject*
-ceph_set_module_option_ex(BaseMgrModule *self, PyObject *args)
+ceph_set_module_option(BaseMgrModule *self, PyObject *args)
{
char *module = nullptr;
char *key = nullptr;
char *value = nullptr;
- if (!PyArg_ParseTuple(args, "ssz:ceph_set_module_option_ex",
+ if (!PyArg_ParseTuple(args, "ssz:ceph_set_module_option",
&module, &key, &value)) {
derr << "Invalid args!" << dendl;
return nullptr;
Py_RETURN_NONE;
}
-static PyObject*
-ceph_set_module_option(BaseMgrModule *self, PyObject *args)
-{
- char *key = nullptr;
- char *value = nullptr;
- if (!PyArg_ParseTuple(args, "sz:ceph_set_module_option", &key, &value)) {
- derr << "Invalid args!" << dendl;
- return nullptr;
- }
- boost::optional<string> val;
- if (value) {
- val = value;
- }
- self->py_modules->set_config(self->this_module->get_name(), key, val);
-
- Py_RETURN_NONE;
-}
-
static PyObject*
ceph_store_get(BaseMgrModule *self, PyObject *args)
{
}
}
-
-
static PyObject*
ceph_store_set(BaseMgrModule *self, PyObject *args)
{
{"_ceph_get_module_option", (PyCFunction)ceph_get_module_option, METH_VARARGS,
"Get a module configuration option value"},
- {"_ceph_get_module_option_ex", (PyCFunction)ceph_get_module_option_ex, METH_VARARGS,
- "Get a module configuration option value from the specified module"},
-
{"_ceph_get_store_prefix", (PyCFunction)ceph_store_get_prefix, METH_VARARGS,
"Get all KV store values with a given prefix"},
{"_ceph_set_module_option", (PyCFunction)ceph_set_module_option, METH_VARARGS,
"Set a module configuration option value"},
- {"_ceph_set_module_option_ex", (PyCFunction)ceph_set_module_option_ex, METH_VARARGS,
- "Set a module configuration option value for the specified module"},
-
{"_ceph_get_store", (PyCFunction)ceph_store_get, METH_VARARGS,
"Get a stored field"},
format(key, self.__class__.__name__))
def _get_module_option(self, key, default):
- r = self._ceph_get_module_option(key)
+ r = self._ceph_get_module_option(self.module_name, key)
if r is None:
final_key = key.split('/')[-1]
return self.MODULE_OPTION_DEFAULTS.get(final_key, default)
"""
if module == self.module_name:
self._validate_module_option(key)
- r = self._ceph_get_module_option_ex(module, key)
+ r = self._ceph_get_module_option(module, key)
return default if r is None else r
def get_store_prefix(self, key_prefix):
return self._get_localized(key, default, self._get_module_option)
def _set_module_option(self, key, val):
- return self._ceph_set_module_option(key, str(val))
+ return self._ceph_set_module_option(self.module_name, key, str(val))
def set_module_option(self, key, val):
"""
"""
if module == self.module_name:
self._validate_module_option(key)
- return self._ceph_set_module_option_ex(module, key, str(val))
+ return self._ceph_set_module_option(module, key, str(val))
def set_localized_module_option(self, key, val):
"""