]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/volumes/nfs: Delete user on removing export
authorVarsha Rao <varao@redhat.com>
Tue, 5 May 2020 10:38:49 +0000 (16:08 +0530)
committerVarsha Rao <varao@redhat.com>
Wed, 8 Jul 2020 05:36:34 +0000 (07:36 +0200)
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit b9bff573c965bfa5c90919431e8791610fef7787)

src/pybind/mgr/volumes/fs/nfs.py

index 8db38fa6aceb0c3bbfa30e53f71b8ffda1301815..4ccb97be3ec2a2ba878b73c62b01099b7601d043 100644 (file)
@@ -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: