glusterfs/volume layout: fix incorrect usage of export_location
Actually, all uses of export_location are incorrect -- from the layout code's point of view, export_location is an arbitrary opaque value, obtained from self.driver._setup_via_manager with which the only legit action is to return it from create_share*. That we use export_location as dict key in ensure_share is just a pre-layout relict that survived by the virtue of remaining unnoticed. Now the referred bug forced it out of the dark. Change-Id: I965dae99486002f00145daff0cd2a848777b5b81 Partial-Bug: #1501670
This commit is contained in:
parent
cb4db916d3
commit
e91632b6e2
|
@ -584,7 +584,8 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
|
|||
|
||||
def ensure_share(self, context, share, share_server=None):
|
||||
"""Invoked to ensure that share is exported."""
|
||||
self.gluster_used_vols.add(share['export_location'])
|
||||
gmgr = self._share_manager(share)
|
||||
self.gluster_used_vols.add(gmgr.qualified)
|
||||
|
||||
# Debt...
|
||||
|
||||
|
|
|
@ -290,10 +290,15 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
|
|||
|
||||
def test_ensure_share(self):
|
||||
share = self.share1
|
||||
gmgr1 = common.GlusterManager(self.glusterfs_target1, self._execute,
|
||||
None, None)
|
||||
self.mock_object(self._layout, '_share_manager',
|
||||
mock.Mock(return_value=gmgr1))
|
||||
|
||||
self._layout.ensure_share(self._context, share)
|
||||
|
||||
self.assertIn(share['export_location'], self._layout.gluster_used_vols)
|
||||
self._layout._share_manager.assert_called_once_with(share)
|
||||
self.assertIn(self.glusterfs_target1, self._layout.gluster_used_vols)
|
||||
|
||||
@ddt.data({"voldict": {"host:/share2G": {"size": 2}}, "used_vols": set(),
|
||||
"size": 1, "expected": "host:/share2G"},
|
||||
|
|
Loading…
Reference in New Issue