}
}
+static PyObject*
+ceph_store_get(BaseMgrStandbyModule *self, PyObject *args)
+{
+ char *what = nullptr;
+ if (!PyArg_ParseTuple(args, "s:ceph_store_get", &what)) {
+ derr << "Invalid args!" << dendl;
+ return nullptr;
+ }
+
+ std::string value;
+ bool found = self->this_module->get_store(what, &value);
+ if (found) {
+ dout(10) << "ceph_store_get " << what << " found: " << value.c_str() << dendl;
+ return PyString_FromString(value.c_str());
+ } else {
+ dout(4) << "ceph_store_get " << what << " not found " << dendl;
+ Py_RETURN_NONE;
+ }
+}
+
static PyObject*
ceph_get_active_uri(BaseMgrStandbyModule *self, PyObject *args)
{
{"_ceph_get_config", (PyCFunction)ceph_config_get, METH_VARARGS,
"Get a configuration value"},
+ {"_ceph_get_store", (PyCFunction)ceph_store_get, METH_VARARGS,
+ "Get a KV store value"},
+
{"_ceph_get_active_uri", (PyCFunction)ceph_get_active_uri, METH_NOARGS,
"Get the URI of the active instance of this module, if any"},
else:
return r
+ def get_store(self, key):
+ """
+ Retrieve the value of a persistent KV store entry
+
+ :param key: String
+ :return: Byte string or None
+ """
+ return self._ceph_get_store(key)
def get_active_uri(self):
return self._ceph_get_active_uri()