]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: add --squash to 'nfs export create'
authorSage Weil <sage@newdream.net>
Wed, 26 May 2021 17:59:18 +0000 (13:59 -0400)
committerSage Weil <sage@newdream.net>
Thu, 17 Jun 2021 20:18:06 +0000 (16:18 -0400)
Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/nfs/export.py
src/pybind/mgr/nfs/module.py

index 6db66ed798b9ed96ea6d96bdc993821e8fd6378c..cc8c8c657bc0e8ada1af6904ffc5f4acab48f96c 100644 (file)
@@ -430,7 +430,7 @@ class FSExport(ExportMgr):
         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)
 
@@ -448,24 +448,25 @@ class FSExport(ExportMgr):
             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"
 
index 0ebb92e968b21a2debf8375937225dd85c5854d2..1a0abedef14d36be138676f8e14f5d1acb75e6bf 100644 (file)
@@ -24,17 +24,21 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
             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]: