From 4f2e400a6bcbcb79103354a76211455f9e7c605a Mon Sep 17 00:00:00 2001 From: linpeiwen Date: Thu, 2 Jul 2020 04:48:17 -0400 Subject: [PATCH] [Glusterfs] Fix delete share, mount point not disconnected When we delete the shared instance, in addition to erasing the data in the share, we should disconnect the client's mount point to prevent the data from being written in. Closes-Bug: #1886010 Change-Id: I7a334fb895669cc807a288e6aefe62154a89a7e4 (cherry picked from commit 9d44ba0b6a2d20be6158ff667ff3b81de31f5cad) --- manila/share/drivers/glusterfs/layout_volume.py | 1 + manila/tests/share/drivers/glusterfs/test_layout_volume.py | 6 ++++-- ...ug-1886010-Glusterfs-fix-del-share-89dabc8751ed4fec.yaml | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1886010-Glusterfs-fix-del-share-89dabc8751ed4fec.yaml diff --git a/manila/share/drivers/glusterfs/layout_volume.py b/manila/share/drivers/glusterfs/layout_volume.py index 3345a32e61..72ee0c71a3 100644 --- a/manila/share/drivers/glusterfs/layout_volume.py +++ b/manila/share/drivers/glusterfs/layout_volume.py @@ -433,6 +433,7 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase): # them to the pool (after some purification rituals) self._wipe_gluster_vol(gmgr) gmgr.set_vol_option(USER_MANILA_SHARE, 'NONE') + gmgr.set_vol_option('nfs.disable', 'on') self._push_gluster_vol(gmgr.qualified) except exception.GlusterfsException: diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py index ea84af55ad..a4fe8e6a34 100644 --- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py +++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py @@ -600,8 +600,10 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): self.glusterfs_target1) self._layout.private_storage.delete.assert_called_once_with( self.share1['id']) - gmgr1.set_vol_option.assert_called_once_with( - 'user.manila-share', 'NONE') + gmgr1.set_vol_option.assert_has_calls([ + mock.call('user.manila-share', 'NONE'), + mock.call('nfs.disable', 'on') + ]) def test_delete_share_clone(self): self._layout._push_gluster_vol = mock.Mock() diff --git a/releasenotes/notes/bug-1886010-Glusterfs-fix-del-share-89dabc8751ed4fec.yaml b/releasenotes/notes/bug-1886010-Glusterfs-fix-del-share-89dabc8751ed4fec.yaml new file mode 100644 index 0000000000..4e5955142e --- /dev/null +++ b/releasenotes/notes/bug-1886010-Glusterfs-fix-del-share-89dabc8751ed4fec.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed `bug #1886010 `_ + This bug caused glusterfs shares to still be readable/writable to + connected clients while the share was deleted from manila.