[SVF]: Volume name is not validated for host
[Spectrum Virtualize Family] During terminate_connection volume_name is passed as input to ensure that volume mapping for the host is removed. Currently get_host_by_connector ignore the volume_name validation if the host is found in the connector wwpns. This causes issues in some scenarios where WWPNS from different host entry are passed. Closes-Bug: #1892034 Change-Id: I55f7dd92a4a1bab4a6b00d1b42707aa98b4b2eae
This commit is contained in:
parent
a7c5d07256
commit
6f1531ab1b
@ -8364,6 +8364,59 @@ class StorwizeHelpersTestCase(test.TestCase):
|
||||
self.storwize_svc_common.pretreatment_before_revert(vol)
|
||||
stopfcmap.assert_called_once_with('4', split=True)
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsfabric')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lshost')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsvdiskhostmap')
|
||||
def test_get_host_from_connector_with_vol(self,
|
||||
lsvdishosmap,
|
||||
lshost,
|
||||
lsfabric):
|
||||
vol = 'testvol'
|
||||
connector = {"wwpns": ["10000090fa3870d7", "C050760825191B00"]}
|
||||
lsfabric.return_value = [{"remote_wwpn": "10000090fa3870d7",
|
||||
"name": "test_host"}]
|
||||
raw = "id!name!host_id!host_name!vdisk_UID\n2594!testvol!315!"\
|
||||
"test_host!60050768028110A4700000000001168E"
|
||||
ssh_cmd = ['svcinfo', 'lsvdiskhostmap', '-delim', '!', '"%s"' % vol]
|
||||
lsvdishosmap.return_value = storwize_svc_common.CLIResponse(raw,
|
||||
ssh_cmd,
|
||||
'!',
|
||||
True)
|
||||
host = self.storwize_svc_common.get_host_from_connector(connector,
|
||||
vol)
|
||||
self.assertEqual(host, "test_host")
|
||||
lsfabric.assert_called_with(wwpn='10000090fa3870d7')
|
||||
self.assertEqual(1, lsfabric.call_count)
|
||||
lsvdishosmap.assert_called_with(vol)
|
||||
self.assertEqual(1, lsvdishosmap.call_count)
|
||||
lshost.assert_not_called()
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsfabric')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lshost')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsvdiskhostmap')
|
||||
def test_get_host_from_connector_wo_vol(self,
|
||||
lsvdishosmap,
|
||||
lshost,
|
||||
lsfabric):
|
||||
vol = 'testvol'
|
||||
connector = {"wwpns": ["10000090fa3870d7", "C050760825191B00"]}
|
||||
lsfabric.return_value = [{"remote_wwpn": "10000090fa3870d7",
|
||||
"name": "test_host"}]
|
||||
raw = "id!name!host_id!host_name!vdisk_UID\n2594!testvol!315!"\
|
||||
"test_host!60050768028110A4700000000001168E"
|
||||
ssh_cmd = ['svcinfo', 'lsvdiskhostmap', '-delim', '!', '"%s"' % vol]
|
||||
lsvdishosmap.return_value = storwize_svc_common.CLIResponse(raw,
|
||||
ssh_cmd,
|
||||
'!',
|
||||
True)
|
||||
host = self.storwize_svc_common.get_host_from_connector(connector)
|
||||
self.assertEqual(host, "test_host")
|
||||
lsfabric.assert_called_with(wwpn='10000090fa3870d7')
|
||||
self.assertEqual(1, lsfabric.call_count)
|
||||
lsvdishosmap.assert_not_called()
|
||||
self.assertEqual(0, lsvdishosmap.call_count)
|
||||
lshost.assert_not_called()
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class StorwizeSSHTestCase(test.TestCase):
|
||||
|
@ -1038,6 +1038,20 @@ class StorwizeHelpers(object):
|
||||
self.handle_keyerror('lsfabric', wwpn_info)
|
||||
if host_name:
|
||||
break
|
||||
|
||||
if host_name and volume_name:
|
||||
hosts_map_info = self.ssh.lsvdiskhostmap(volume_name)
|
||||
hosts_map_info_list = list(hosts_map_info.select('host_name'))
|
||||
if host_name in hosts_map_info_list:
|
||||
LOG.debug("get_host_from_connector: hosts_map_info:"
|
||||
" %s", hosts_map_info_list)
|
||||
LOG.debug('Leave: get_host_from_connector host %s', host_name)
|
||||
return host_name
|
||||
else:
|
||||
LOG.debug('get_host_from_connector: host %s not mapped '
|
||||
'to volume', host_name)
|
||||
host_name = None
|
||||
|
||||
if host_name:
|
||||
LOG.debug('Leave: get_host_from_connector: host %s.', host_name)
|
||||
return host_name
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
IBM Spectrum Virtualize Family driver `Bug #1892034
|
||||
<https://bugs.launchpad.net/cinder/+bug/1892034>`_: Fixed issue in
|
||||
get_host_from_connector that volume name is not validated to get the
|
||||
host during terminate connection when the volume name is passed as input.
|
Loading…
Reference in New Issue
Block a user