]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/cephfs: interface to fetch file system id
authorVenky Shankar <vshankar@redhat.com>
Thu, 22 Apr 2021 08:47:52 +0000 (04:47 -0400)
committerVenky Shankar <vshankar@redhat.com>
Mon, 31 May 2021 04:30:52 +0000 (00:30 -0400)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/pybind/cephfs/c_cephfs.pxd
src/pybind/cephfs/cephfs.pyx
src/pybind/cephfs/mock_cephfs.pxi

index 5b0fa29924eb17f0b274c9026c95511942357c4b..4636b4bf45d26aefcd493316eb89f1bfab790f0c 100644 (file)
@@ -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)
index a9324d6fc38cf4f9cde84062254ea74ef05c3538..96125ba2e43698c0dc13a7d22bc5c0071040a317 100644 (file)
@@ -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.
index d78016f4cce1b899e5bbacaccf0c1549c6ca0ea6..1dec0d50d5476584c5f8de812b56628ce33fa019 100644 (file)
@@ -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):