log.info("Export user created is {}".format(json_res[0]['entity']))
return json_res[0]['entity'], json_res[0]['key']
- def create_export(self, fs_name, cluster_id, pseudo_path, read_only, path):
+ def create_export(self, fs_name, cluster_id, pseudo_path, read_only, path, squash):
if not check_fs(self.mgr, fs_name):
raise FSNotFound(fs_name)
if read_only:
access_type = "RO"
ex_dict = {
- 'path': self.format_path(path),
- 'pseudo': pseudo_path,
- 'cluster_id': cluster_id,
- 'access_type': access_type,
- 'fsal': {"name": "CEPH", "user_id": user_id,
- "fs_name": fs_name, "sec_label_xattr": ""},
- 'clients': []
- }
+ 'path': self.format_path(path),
+ 'pseudo': pseudo_path,
+ 'cluster_id': cluster_id,
+ 'access_type': access_type,
+ 'squash': squash,
+ 'fsal': {"name": "CEPH", "user_id": user_id,
+ "fs_name": fs_name, "sec_label_xattr": ""},
+ 'clients': []
+ }
export = Export.from_dict(ex_id, ex_dict)
export.fsal.cephx_key = key
self._save_export(export)
result = {
- "bind": pseudo_path,
- "fs": fs_name,
- "path": path,
- "cluster": cluster_id,
- "mode": access_type,
- }
+ "bind": pseudo_path,
+ "fs": fs_name,
+ "path": path,
+ "cluster": cluster_id,
+ "mode": access_type,
+ }
return (0, json.dumps(result, indent=4), '')
return 0, "", "Export already exists"
self.inited = True
@CLICommand('nfs export create cephfs', perm='rw')
- def _cmd_nfs_export_create_cephfs(self,
- fsname: str,
- clusterid: str,
- binding: str,
- path: str = '/',
- readonly: bool = False) -> Tuple[int, str, str]:
+ def _cmd_nfs_export_create_cephfs(
+ self,
+ fsname: str,
+ clusterid: str,
+ binding: str,
+ path: str = '/',
+ readonly: bool = False,
+ squash: str = 'none',
+ ) -> Tuple[int, str, str]:
"""Create a cephfs export"""
# TODO Extend export creation for rgw.
return self.export_mgr.create_export(fsal_type='cephfs', fs_name=fsname,
cluster_id=clusterid, pseudo_path=binding,
- read_only=readonly, path=path)
+ read_only=readonly, path=path,
+ squash=squash)
@CLICommand('nfs export rm', perm='rw')
def _cmd_nfs_export_rm(self, clusterid: str, binding: str) -> Tuple[int, str, str]: