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 <sage@newdream.net>
This commit is contained in:
Sage Weil 2021-06-17 16:01:50 -04:00
parent 0907658f21
commit 1529f78ecf
2 changed files with 4 additions and 10 deletions

View 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,

View 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