Storwize: fix an incorrect temporary parameter name

The parameter “iscsi” is defined in the function get_host_from_connector
definition. But it is used as the other temporary parameter name in this
function.

This patch modify the temporary parameter name from “iscsi” to “iscsi_name”.

Change-Id: Ieba461478059d1e76ecb66dcbb8ca922e486e750
Closes-Bug: 1743695
(cherry picked from commit 6d315d0db7)
This commit is contained in:
yixuanzhang 2018-01-17 15:52:31 +08:00
parent b68def0a5d
commit f756813741
2 changed files with 16 additions and 2 deletions

View File

@ -2513,6 +2513,20 @@ class StorwizeSVCISCSIDriverTestCase(test.TestCase):
init_conn.assert_called_once_with(volume_iSCSI, connector)
term_conn.assert_called_once_with(volume_iSCSI, connector)
def test_storwize_get_host_from_connector_with_both_fc_iscsi_host(self):
volume_iSCSI = self._create_volume()
extra_spec = {'capabilities:storage_protocol': '<in> iSCSI'}
vol_type_iSCSI = volume_types.create(self.ctxt, 'iSCSI', extra_spec)
volume_iSCSI['volume_type_id'] = vol_type_iSCSI['id']
connector = {'host': 'storwize-svc-host',
'initiator': 'iqn.1993-08.org.debian:01:eac5ccc1aaa'}
if self.USESIM:
self.sim._cmd_mkhost(name='storwize-svc-host-99999999',
hbawwpn='123')
self.iscsi_driver.initialize_connection(volume_iSCSI, connector)
self.iscsi_driver.terminate_connection(volume_iSCSI, connector)
@mock.patch.object(storwize_svc_iscsi.StorwizeSVCISCSIDriver,
'_do_terminate_connection')
def test_storwize_initialize_iscsi_connection_failure(self, term_conn):

View File

@ -958,8 +958,8 @@ class StorwizeHelpers(object):
pass
if iscsi:
if 'initiator' in connector:
for iscsi in resp.select('iscsi_name'):
if iscsi == connector['initiator']:
for iscsi_name in resp.select('iscsi_name'):
if iscsi_name == connector['initiator']:
host_name = name
found = True
break