From: huanwen ren Date: Thu, 18 Aug 2016 11:59:34 +0000 (+0800) Subject: libcephfs: add unmount function in cephfs.pyx X-Git-Tag: v11.0.1~324^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a0e274c67e8b2a18e8ee9d0f9c1fa33515bcd08;p=ceph.git libcephfs: add unmount function in cephfs.pyx we need unmount function when change the mount point Signed-off-by: huanwen ren --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index bd14de3b167..3ce92d2abf0 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -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')