From 8216447c3c6b38056b25a33c76e1bfaf6bbab899 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 2 Jun 2021 17:54:23 +0200 Subject: [PATCH] mgr/nfs: ExportMgr._delete_export only works for cephfs for now Signed-off-by: Sebastian Wagner (cherry picked from commit 8ba3b5bf2e0492c73c0982fa1389cb46edbf2475) --- src/pybind/mgr/nfs/export.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/nfs/export.py b/src/pybind/mgr/nfs/export.py index c67874e7470fd..04bd83c454118 100644 --- a/src/pybind/mgr/nfs/export.py +++ b/src/pybind/mgr/nfs/export.py @@ -6,7 +6,7 @@ from os.path import normpath from rados import TimedOut, ObjectNotFound -from .export_utils import GaneshaConfParser, Export, RawBlock +from .export_utils import GaneshaConfParser, Export, RawBlock, CephFSFSAL, RGWFSAL from .exception import NFSException, NFSInvalidOperation, NFSObjectNotFound, FSNotFound, \ ClusterNotFound from .utils import POOL_NAME, available_clusters, check_fs @@ -173,10 +173,10 @@ class ExportMgr: f'conf-nfs.{export.cluster_id}' ) - def _delete_export(self, cluster_id: str, pseudo_path: Optional[str], export_obj: Optional[Any] = None) -> Tuple[int, str, str]: + def _delete_export(self, cluster_id: str, pseudo_path: Optional[str], export_obj: Optional[Export] = None) -> Tuple[int, str, str]: try: if export_obj: - export = export_obj + export: Optional[Export] = export_obj else: export = self._fetch_export(cluster_id, pseudo_path) @@ -185,7 +185,9 @@ class ExportMgr: NFSRados(self.mgr, cluster_id).remove_obj( f'export-{export.export_id}', f'conf-nfs.{cluster_id}') self.exports[cluster_id].remove(export) - self._delete_user(export.fsal.user_id) + if isinstance(export.fsal, CephFSFSAL) or isinstance(export.fsal, RGWFSAL): + assert export.fsal.user_id + self._delete_user(export.fsal.user_id) if not self.exports[cluster_id]: del self.exports[cluster_id] return 0, "Successfully deleted export", "" -- 2.39.5