Merge "Fix Manila HNAS driver managing a share twice"
This commit is contained in:
commit
68f2e8e286
@ -481,12 +481,12 @@ class HitachiHNASDriver(driver.ShareDriver):
|
||||
{'shr_path': share['export_locations'][0]['path'],
|
||||
'shr_id': share['id']})
|
||||
|
||||
old_path_info = share['export_locations'][0]['path'].split(':')
|
||||
old_path = old_path_info[1].split('/')
|
||||
old_path_info = share['export_locations'][0]['path'].split(
|
||||
':/shares/')
|
||||
|
||||
if len(old_path) == 3:
|
||||
if len(old_path_info) == 2:
|
||||
evs_ip = old_path_info[0]
|
||||
hnas_share_id = old_path[2]
|
||||
hnas_share_id = old_path_info[1]
|
||||
else:
|
||||
msg = _("Incorrect path. It should have the following format: "
|
||||
"IP:/shares/share_id.")
|
||||
|
@ -596,14 +596,19 @@ class HitachiHNASTestCase(test.TestCase):
|
||||
self.assertRaises(exception.HNASBackendException,
|
||||
self._driver.manage_existing, share_nfs, 'option')
|
||||
|
||||
@ddt.data(share_nfs, share_cifs)
|
||||
def test_manage_existing_wrong_path_format(self, share):
|
||||
share_copy = share.copy()
|
||||
share_copy['export_locations'] = [{'path': ':/'}]
|
||||
@ddt.data(':/', '1.1.1.1:/share_id', '1.1.1.1:/shares',
|
||||
'1.1.1.1:shares/share_id', ':/share_id')
|
||||
def test_manage_existing_wrong_path_format(self, wrong_location):
|
||||
expected_exception = ("Share backend error: Incorrect path. It "
|
||||
"should have the following format: "
|
||||
"IP:/shares/share_id.")
|
||||
share_copy = share_nfs.copy()
|
||||
share_copy['export_locations'] = [{'path': wrong_location}]
|
||||
|
||||
self.assertRaises(exception.ShareBackendException,
|
||||
self._driver.manage_existing, share_copy,
|
||||
'option')
|
||||
ex = self.assertRaises(exception.ShareBackendException,
|
||||
self._driver.manage_existing, share_copy,
|
||||
'option')
|
||||
self.assertEqual(expected_exception, ex.msg)
|
||||
|
||||
def test_manage_existing_wrong_evs_ip(self):
|
||||
share_nfs['export_locations'] = [{'path': '172.24.44.189:/shares/'
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixed Hitachi HNAS driver allowing a share to be managed twice through
|
||||
a malformed export location parameter.
|
Loading…
Reference in New Issue
Block a user