From: Venky Shankar Date: Thu, 22 Apr 2021 08:47:52 +0000 (-0400) Subject: pybind/cephfs: interface to fetch file system id X-Git-Tag: v17.1.0~1613^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e9b840198041adee50b948ade89b9e7c837b6ce;p=ceph.git pybind/cephfs: interface to fetch file system id Signed-off-by: Venky Shankar --- diff --git a/src/pybind/cephfs/c_cephfs.pxd b/src/pybind/cephfs/c_cephfs.pxd index 5b0fa29924eb..4636b4bf45d2 100644 --- a/src/pybind/cephfs/c_cephfs.pxd +++ b/src/pybind/cephfs/c_cephfs.pxd @@ -46,6 +46,7 @@ cdef extern from "cephfs/libcephfs.h" nogil: void ceph_shutdown(ceph_mount_info *cmount) int ceph_getaddrs(ceph_mount_info* cmount, char** addrs) + int64_t ceph_get_fs_cid(ceph_mount_info *cmount) int ceph_conf_read_file(ceph_mount_info *cmount, const char *path_list) int ceph_conf_parse_argv(ceph_mount_info *cmount, int argc, const char **argv) int ceph_conf_get(ceph_mount_info *cmount, const char *option, char *buf, size_t len) diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index a9324d6fc38c..96125ba2e436 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -481,6 +481,17 @@ cdef class LibCephFS(object): for key, value in conf.items(): self.conf_set(key, value) + def get_fscid(self): + """ + Return the file system id for this fs client. + """ + self.require_state("mounted") + with nogil: + ret = ceph_get_fs_cid(self.cluster) + if ret < 0: + raise make_ex(ret, "error fetching fscid") + return ret + def get_addrs(self): """ Get associated client addresses with this RADOS session. diff --git a/src/pybind/cephfs/mock_cephfs.pxi b/src/pybind/cephfs/mock_cephfs.pxi index d78016f4cce1..1dec0d50d547 100644 --- a/src/pybind/cephfs/mock_cephfs.pxi +++ b/src/pybind/cephfs/mock_cephfs.pxi @@ -55,6 +55,8 @@ cdef nogil: int ceph_getaddrs(ceph_mount_info* cmount, char** addrs): pass + int64_t ceph_get_fs_cid(ceph_mount_info *cmount): + pass int ceph_conf_read_file(ceph_mount_info *cmount, const char *path_list): pass int ceph_conf_parse_argv(ceph_mount_info *cmount, int argc, const char **argv):