]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/PyState: add get_mgr_id() to module interface
authorSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 14:05:08 +0000 (10:05 -0400)
committerSage Weil <sage@redhat.com>
Thu, 8 Jun 2017 18:29:37 +0000 (14:29 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/PyState.cc
src/pybind/mgr/mgr_module.py

index 1635f761d6c7c3a944758740efd650c3d10c1435..0b99e684ae81be586484a35ca725a78d6528599d 100644 (file)
@@ -186,6 +186,12 @@ ceph_get_server(PyObject *self, PyObject *args)
   }
 }
 
+static PyObject*
+ceph_get_mgr_id(PyObject *self, PyObject *args)
+{
+  return PyString_FromString(g_conf->name.get_id().c_str());
+}
+
 static PyObject*
 ceph_config_get(PyObject *self, PyObject *args)
 {
@@ -313,6 +319,8 @@ PyMethodDef CephStateMethods[] = {
      "Get a service's metadata"},
     {"send_command", ceph_send_command, METH_VARARGS,
      "Send a mon command"},
+    {"get_mgr_id", ceph_get_mgr_id, METH_NOARGS,
+     "Get the mgr id"},
     {"get_config", ceph_config_get, METH_VARARGS,
      "Get a configuration value"},
     {"set_config", ceph_config_set, METH_VARARGS,
index 20a893a9e6bb396647f210be8b11e7f36303ddab..03f642e0577a6b36e1e148887ed8592567ae44a7 100644 (file)
@@ -165,6 +165,14 @@ class MgrModule(object):
         # any ``COMMANDS``
         raise NotImplementedError()
 
+    def get_mgr_id(self):
+        """
+        Retrieve the mgr id.
+
+        :return: str
+        """
+        return ceph_state.get_mgr_id()
+
     def get_config(self, key):
         """
         Retrieve the value of a persistent configuration setting