]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: handle option addr/client block in create_export()
authorSage Weil <sage@newdream.net>
Mon, 7 Jun 2021 20:52:30 +0000 (16:52 -0400)
committerSage Weil <sage@newdream.net>
Mon, 21 Jun 2021 18:13:15 +0000 (14:13 -0400)
Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/nfs/export.py
src/pybind/mgr/nfs/module.py

index 56bd2a698dd09b7585aa783823de09d62824acdb..c369bcc38f4edd6aa1ecaefb2b15306d8165a187 100644 (file)
@@ -269,7 +269,18 @@ class ExportMgr:
         return path
 
     @export_cluster_checker
-    def create_export(self, **kwargs: Any) -> Tuple[int, str, str]:
+    def create_export(self, addr: Optional[List[str]] = None, **kwargs: Any) -> Tuple[int, str, str]:
+        # if addr(s) are provided, construct client list and adjust outer block
+        clients = []
+        if addr:
+            clients = [{
+                'addresses': addr,
+                'access_type': 'ro' if kwargs['read_only'] else 'rw',
+                'squash': kwargs['squash'],
+            }]
+            kwargs['squash'] = 'none'
+        kwargs['clients'] = clients
+
         try:
             fsal_type = kwargs.pop('fsal_type')
             if fsal_type == 'cephfs':
index c4cda93214a7d1eb5570fa14ed982eb83cf6fa4d..4a84eda3670c79752735a0e87a292e45dcea3111 100644 (file)
@@ -36,18 +36,10 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
             squash: str = 'none',
     ) -> Tuple[int, str, str]:
         """Create a cephfs export"""
-        clients = []
-        if addr:
-            clients = [{
-                'addresses': addr,
-                'access_type': 'ro' if readonly else 'rw',
-                'squash': squash,
-            }]
-            squash = 'none'
         return self.export_mgr.create_export(fsal_type='cephfs', fs_name=fsname,
                                              cluster_id=cluster_id, pseudo_path=binding,
                                              read_only=readonly, path=path,
-                                             squash=squash, clients=clients)
+                                             squash=squash, addr=addr)
 
     @CLICommand('nfs export create rgw', perm='rw')
     def _cmd_rgw_export_create_cephfs(
@@ -60,20 +52,11 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
             realm: Optional[str] = None,
     ) -> Tuple[int, str, str]:
         """Create an RGW export"""
-        clients = []
-        squash = 'none'
-        if addr:
-            clients = [{
-                'addresses': addr,
-                'access_type': 'ro' if readonly else 'rw',
-                'squash': squash,
-            }]
-            squash = 'none'
         return self.export_mgr.create_export(fsal_type='rgw', bucket=bucket,
                                              realm=realm,
                                              cluster_id=cluster_id, pseudo_path=binding,
-                                             read_only=readonly, squash=squash,
-                                             clients=clients)
+                                             read_only=readonly, squash='none',
+                                             addr=addr)
 
     @CLICommand('nfs export import', perm='rw')
     def _cmd_nfs_export_import(self,