]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/cephfs: add interface to set mount timeout
authorVenky Shankar <vshankar@redhat.com>
Fri, 16 Apr 2021 07:02:10 +0000 (03:02 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 4 May 2021 04:58:02 +0000 (00:58 -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 cb266ecf910123ff21ad9e67742b354ab258997f..5b0fa29924eb17f0b274c9026c95511942357c4b 100644 (file)
@@ -50,6 +50,7 @@ cdef extern from "cephfs/libcephfs.h" nogil:
     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)
     int ceph_conf_set(ceph_mount_info *cmount, const char *option, const char *value)
+    int ceph_set_mount_timeout(ceph_mount_info *cmount, uint32_t timeout)
 
     int ceph_mount(ceph_mount_info *cmount, const char *root)
     int ceph_select_filesystem(ceph_mount_info *cmount, const char *fs_name)
index e536fcbe5eb31191c38eeb8ef3904ea6d3f895f3..50e0dd738a34776c9d7cf877579c11d317fc9f83 100644 (file)
@@ -622,6 +622,24 @@ cdef class LibCephFS(object):
         if ret != 0:
             raise make_ex(ret, "error calling conf_set")
 
+    def set_mount_timeout(self, timeout):
+        """
+        Set mount timeout
+
+        :param timeout: mount timeout
+        """
+        self.require_state("configuring", "initialized")
+        if not isinstance(timeout, int):
+            raise TypeError('timeout must be an integer')
+        if timeout < 0:
+            raise make_ex(CEPHFS_EINVAL, 'timeout must be greater than or equal to 0')
+        cdef:
+            uint32_t _timeout = timeout
+        with nogil:
+            ret = ceph_set_mount_timeout(self.cluster, _timeout)
+        if ret != 0:
+            raise make_ex(ret, "error setting mount timeout")
+
     def init(self):
         """
         Initialize the filesystem client (but do not mount the filesystem yet)
index c871b8b353b3890871dac195239bb4f6f2a6add0..d78016f4cce1b899e5bbacaccf0c1549c6ca0ea6 100644 (file)
@@ -63,6 +63,8 @@ cdef nogil:
         pass
     int ceph_conf_set(ceph_mount_info *cmount, const char *option, const char *value):
         pass
+    int ceph_set_mount_timeout(ceph_mount_info *cmount, uint32_t timeout):
+        pass
 
     int ceph_mount(ceph_mount_info *cmount, const char *root):
         pass