]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: add unmount function in cephfs.pyx
authorhuanwen ren <ren.huanwen@zte.com.cn>
Thu, 18 Aug 2016 11:59:34 +0000 (19:59 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Wed, 31 Aug 2016 00:44:32 +0000 (08:44 +0800)
we need unmount function when change the mount point

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/pybind/cephfs/cephfs.pyx

index bd14de3b167d3a5fce19ed0e32cc188f6d08e78f..3ce92d2abf0349f8dfbd77176d672e999b6d38e5 100644 (file)
@@ -108,6 +108,7 @@ cdef extern from "cephfs/libcephfs.h" nogil:
     int ceph_conf_set(ceph_mount_info *cmount, const char *option, const char *value)
 
     int ceph_mount(ceph_mount_info *cmount, const char *root)
+    int ceph_unmount(ceph_mount_info *cmount)
     int ceph_fstat(ceph_mount_info *cmount, int fd, stat *stbuf)
     int ceph_stat(ceph_mount_info *cmount, const char *path, stat *stbuf)
     int ceph_statfs(ceph_mount_info *cmount, const char *path, statvfs *stbuf)
@@ -479,6 +480,14 @@ cdef class LibCephFS(object):
             raise make_ex(ret, "error calling ceph_mount")
         self.state = "mounted"
 
+    def unmount(self):
+        self.require_state("mounted")
+        with nogil:
+            ret = ceph_unmount(self.cluster)
+        if ret != 0:
+            raise make_ex(ret, "error calling ceph_unmount")
+        self.state = "initialized"
+
     def statfs(self, path):
         self.require_state("mounted")
         path = cstr(path, 'path')