From 255808d97bf2b3d0bc691ed95f9fd5c18a250a86 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 17 Jun 2021 16:01:50 -0400 Subject: [PATCH] mgr/nfs: merge FSExport back into ExportMgr 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 (cherry picked from commit 1529f78ecf43ddc878ae028e6a56baa87daeed3b) --- src/pybind/mgr/nfs/export.py | 12 +++--------- src/pybind/mgr/nfs/tests/test_nfs.py | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/nfs/export.py b/src/pybind/mgr/nfs/export.py index 5b257154932cf..cb14fc793df7a 100644 --- a/src/pybind/mgr/nfs/export.py +++ b/src/pybind/mgr/nfs/export.py @@ -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, diff --git a/src/pybind/mgr/nfs/tests/test_nfs.py b/src/pybind/mgr/nfs/tests/test_nfs.py index fe1776f52a066..1fa271ad801ef 100644 --- a/src/pybind/mgr/nfs/tests/test_nfs.py +++ b/src/pybind/mgr/nfs/tests/test_nfs.py @@ -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 -- 2.39.5