From 0689aeb65a7470fb08714c0f571942d748cbb1ba Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Tue, 5 May 2020 16:08:49 +0530 Subject: [PATCH] mgr/volumes/nfs: Delete user on removing export Signed-off-by: Varsha Rao (cherry picked from commit b9bff573c965bfa5c90919431e8791610fef7787) --- src/pybind/mgr/volumes/fs/nfs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index 8db38fa6aceb0..4ccb97be3ec2a 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -225,6 +225,15 @@ class FSExport(object): return json_res[0]['entity'], json_res[0]['key'] + def _delete_user(self, entity): + ret, out, err = self.mgr.mon_command({ + 'prefix': 'auth del', + 'entity': 'client.{}'.format(entity), + }) + + if ret!= 0: + log.error(f"User could not be deleted: {err}") + def format_path(self, path): if path is not None: path = path.strip() @@ -337,6 +346,7 @@ class FSExport(object): common_conf = 'conf-nfs.ganesha-{}'.format(cluster_id) self._delete_export_url(common_conf, export.export_id) self.exports[cluster_id].remove(export) + self._delete_user(export.fsal.user_id) else: log.warn("Export does not exist") except KeyError: -- 2.39.5