]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: merge FSExport back into ExportMgr
authorSage Weil <sage@newdream.net>
Thu, 17 Jun 2021 20:01:50 +0000 (16:01 -0400)
committerSebastian Wagner <sewagner@redhat.com>
Thu, 9 Sep 2021 14:17:49 +0000 (16:17 +0200)
This class captures no data, and the current methods cover both cephfs
and rgw exports.  There is little value to making the class separate from
ExportMgr.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 1529f78ecf43ddc878ae028e6a56baa87daeed3b)

src/pybind/mgr/nfs/export.py
src/pybind/mgr/nfs/tests/test_nfs.py

index 5b257154932cff212aa947f4bc92e51f1705e3ec..cb14fc793df7a2a46628e56dcd90393650e823a3 100644 (file)
@@ -284,9 +284,9 @@ class ExportMgr:
         try:
             fsal_type = kwargs.pop('fsal_type')
             if fsal_type == 'cephfs':
-                return FSExport(self).create_cephfs_export(**kwargs)
+                return self.create_cephfs_export(**kwargs)
             if fsal_type == 'rgw':
-                return FSExport(self).create_rgw_export(**kwargs)
+                return self.create_rgw_export(**kwargs)
             raise NotImplementedError()
         except Exception as e:
             return exception_handler(e, f"Failed to create {kwargs['pseudo_path']} export for {kwargs['cluster_id']}")
@@ -350,18 +350,12 @@ class ExportMgr:
                 raise NFSInvalidOperation("Empty Config!!")
             new_export = json.loads(export_config)
             # check export type
-            return FSExport(self).update_export_1(cluster_id, new_export)
+            return self.update_export_1(cluster_id, new_export)
         except NotImplementedError:
             return 0, " Manual Restart of NFS PODS required for successful update of exports", ""
         except Exception as e:
             return exception_handler(e, f'Failed to update export: {e}')
 
-
-class FSExport(ExportMgr):
-    def __init__(self, export_mgr_obj: 'ExportMgr') -> None:
-        super().__init__(export_mgr_obj.mgr,
-                         export_mgr_obj._exports)
-
     def _update_user_id(
             self,
             cluster_id: str,
index fe1776f52a066ef05b0d9b36f80d549d2d77b544..1fa271ad801ef81105e12df9535ee5db732dab23 100644 (file)
@@ -243,7 +243,7 @@ EXPORT
                 mock.patch('nfs.export.ExportMgr._exec', mock_exec), \
                 mock.patch('nfs.export.check_fs', return_value=True), \
                 mock.patch('nfs.export_utils.check_fs', return_value=True), \
-                mock.patch('nfs.export.FSExport._create_user_key',
+                mock.patch('nfs.export.ExportMgr._create_user_key',
                            return_value=('client.abc', 'thekeyforclientabc')):
 
             rados.open_ioctx.return_value.__enter__.return_value = self.io_mock