[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 41b0b95ef6)
(cherry picked from commit 18623a0eeb)
(cherry picked from commit 807b10f8db)
(cherry picked from commit 017c0c42d3)
This commit is contained in:
linpeiwen 2020-09-05 09:42:31 +00:00 committed by Lin PeiWen
parent 0ac95862be
commit 79b837ad6c
3 changed files with 13 additions and 0 deletions

View File

@ -435,6 +435,10 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
gmgr.set_vol_option(USER_MANILA_SHARE, 'NONE')
gmgr.set_vol_option('nfs.disable', 'on')
# 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 "

View File

@ -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(

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixed `bug #1894362 <https://bugs.launchpad.net/manila/+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.