| 234 | return (self.ops_in_progress == 0 and ((time.time() - self.last_used) >= timeout)) |
| 235 | |
| 236 | def connect(self) -> None: |
| 237 | assert self.ops_in_progress == 0 |
| 238 | logger.debug("Connecting to cephfs '{0}'".format(self.fs_name)) |
| 239 | self.fs = cephfs.LibCephFS(rados_inst=self.mgr.rados) |
| 240 | logger.debug("Setting user ID and group ID of CephFS mount as root...") |
| 241 | self.fs.conf_set("client_mount_uid", "0") |
| 242 | self.fs.conf_set("client_mount_gid", "0") |
| 243 | self.fs.conf_set("client_check_pool_perm", "false") |
| 244 | self.fs.conf_set("client_quota", "false") |
| 245 | self.fs.conf_set("client_respect_subvolume_snapshot_visibility", |
| 246 | "false") |
| 247 | self.fs.conf_set("client_fscrypt_as", "false") |
| 248 | logger.debug("CephFS initializing...") |
| 249 | self.fs.init() |
| 250 | logger.debug("CephFS mounting...") |
| 251 | self.fs.mount(filesystem_name=self.fs_name.encode('utf-8')) |
| 252 | logger.debug("Connection to cephfs '{0}' complete".format(self.fs_name)) |
| 253 | self.mgr._ceph_register_client(None, self.fs.get_addrs(), False) |
| 254 | |
| 255 | def disconnect(self) -> None: |
| 256 | try: |