-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCephFS.py
More file actions
35 lines (26 loc) · 918 Bytes
/
Copy pathCephFS.py
File metadata and controls
35 lines (26 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import cephfs
# Configure CephFS and mount the CephFS.
# Only implemented simple CephFS management functions
# More implementations later
class CephFS:
def __init__(self, confFilePath = None, clientPermission = '0'):
self._fileSys = cephfs.LibCephFS()
self._fileSys.conf_read_file()
self._fileSys.conf_set('client_permissions', clientPermission)
self._mounted = False
if self._fileSys.state != 'mounted':
try:
self._fileSys.mount()
self._mounted = True
except Exception as ex:
print(repr(ex))
def getFileSystem(self):
return self._fileSys
def mount(self):
self._fileSys.mount()
self._mounted = True
def unmount(self):
self._fileSys.unmount()
self._mounted = False
def isMounted(self):
return self._mounted