diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index 458a621bb09..aa01f258679 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -3153,6 +3153,20 @@ class StorwizeSVCISCSIDriverTestCase(test.TestCase): self.iscsi_driver.initialize_connection(volume_iSCSI, connector) self.iscsi_driver.terminate_connection(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': ' 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) + def test_storwize_iscsi_connection_snapshot(self): # create a iSCSI volume volume_iSCSI = self._create_volume() diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index 05a8879830e..964671a657c 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -1077,8 +1077,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