From c5eb4b9aa189fd849b2116686be732d17522525e Mon Sep 17 00:00:00 2001 From: linpeiwen Date: Sat, 5 Sep 2020 09:42:31 +0000 Subject: [PATCH] [Glusterfs] Fix delete share, Couldn't find the 'gluster_used_vols' When we have multiple share driver backends, create a shared instance, and the list of'self.gluster_used_vols' will only be updated on the current node. If the RPC request to delete the share instance is sent to other nodes,'self.gluster_used_vols' will be Cannot find the information of the glusterfs volume we want to delete, so we need to update'self.gluster_used_vols' when deleting the instance Change-Id: I14835f6c54376737b41cbf78c94908ea1befde15 Closes-Bug: #1894362 (cherry picked from commit 41b0b95ef67e6c65df3125f94d2fe56b5a3630c6) (cherry picked from commit 18623a0eebe223c0208d70310a8d0308460bd355) (cherry picked from commit 807b10f8dbd45af7ea5d11204b1a1bb2e5a2a9a3) (cherry picked from commit 017c0c42d330ad870187f48a7f469599746051f9) (cherry picked from commit 79b837ad6c0b761d6069da299c4c39ecd44dabf2) --- manila/share/drivers/glusterfs/layout_volume.py | 4 ++++ manila/tests/share/drivers/glusterfs/test_layout_volume.py | 2 ++ ...g-1894362-fix-Glusterfs-del-share-3c8467e1d9f0c6e4.yaml | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/bug-1894362-fix-Glusterfs-del-share-3c8467e1d9f0c6e4.yaml diff --git a/manila/share/drivers/glusterfs/layout_volume.py b/manila/share/drivers/glusterfs/layout_volume.py index 818c5cf109..851e2d7720 100644 --- a/manila/share/drivers/glusterfs/layout_volume.py +++ b/manila/share/drivers/glusterfs/layout_volume.py @@ -434,6 +434,10 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase): self._wipe_gluster_vol(gmgr) gmgr.set_vol_option(USER_MANILA_SHARE, 'NONE') + # When deleting the share instance, we need to + # update'self.gluster_used_vols' again + self.gluster_used_vols = set() + self.gluster_used_vols.add(gmgr.qualified) self._push_gluster_vol(gmgr.qualified) except exception.GlusterfsException: msg = ("Error during delete_share request for " diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py index 3985c0bfb1..638adc8af5 100644 --- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py +++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py @@ -587,6 +587,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): gmgr1 = gmgr(self.glusterfs_target1, self._execute, None, None) gmgr1.set_vol_option = mock.Mock() gmgr1.get_vol_option = mock.Mock(return_value=clone_of) + new_vol_addr = self.glusterfs_target1 self.mock_object(self._layout, '_glustermanager', mock.Mock(return_value=gmgr1)) self._layout.gluster_used_vols = set([self.glusterfs_target1]) @@ -596,6 +597,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): gmgr1.get_vol_option.assert_called_once_with( 'user.manila-cloned-from') self._layout._wipe_gluster_vol.assert_called_once_with(gmgr1) + self.assertIn(new_vol_addr, self._layout.gluster_used_vols) self._layout._push_gluster_vol.assert_called_once_with( self.glusterfs_target1) self._layout.private_storage.delete.assert_called_once_with( diff --git a/releasenotes/notes/bug-1894362-fix-Glusterfs-del-share-3c8467e1d9f0c6e4.yaml b/releasenotes/notes/bug-1894362-fix-Glusterfs-del-share-3c8467e1d9f0c6e4.yaml new file mode 100644 index 0000000000..e1cd5f3e08 --- /dev/null +++ b/releasenotes/notes/bug-1894362-fix-Glusterfs-del-share-3c8467e1d9f0c6e4.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed `bug #1894362 `_ + Fixed the problem of Couldn't find the'gluster_used_vols' error when + deploying glusterfs driver multi-backend service and deleting share + instance.