3PAR get host by WWN now handles mixed cases

The 3PAR driver comparison of WWNs will be able to handle
WWNs with upper/lower case differences. For example, the
driver code can now locate a 3PAR host with a WWN of
123abc6789012345 or 123ABD6789012345.

Change-Id: I571713f34ec3737123920acdbf20999baccd90b2
Closes-Bug: 1546453
This commit is contained in:
Kurt Martin 2016-02-17 13:58:41 -08:00
parent adda63d013
commit 8e0214e281
2 changed files with 23 additions and 2 deletions

View File

@ -5334,6 +5334,26 @@ class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
self.standard_logout)
self.assertNotIn('initiator_target_map', conn_info['data'])
def test_get_3par_host_from_wwn_iqn(self):
mock_client = self.setup_driver()
mock_client.getHosts.return_value = {
'name': self.FAKE_HOST,
'FCPaths': [{'driverVersion': None,
'firmwareVersion': None,
'hostSpeed': 0,
'model': None,
'portPos': {'cardPort': 1, 'node': 1,
'slot': 2},
'vendor': None,
'wwn': '123ab6789012345'}]}
with mock.patch.object(hpecommon.HPE3PARCommon,
'_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
hostname = mock_client._get_3par_hostname_from_wwn_iqn(
wwns=['123AB6789012345', '123CD6789054321'],
iqns=None)
self.assertIsNotNone(hostname)
def test_get_volume_stats1(self):
# setup_mock_client drive with the configuration
# and return the mock HTTP 3PAR client

View File

@ -226,10 +226,11 @@ class HPE3PARCommon(object):
3.0.11 - Fix the image cache capability bug #1491088
3.0.12 - Remove client version checks for replication
3.0.13 - Support creating a cg from a source cg
3.0.14 - Comparison of WWNs now handles case difference. bug #1546453
"""
VERSION = "3.0.13"
VERSION = "3.0.14"
stats = {}
@ -2487,7 +2488,7 @@ class HPE3PARCommon(object):
fc_paths = host['FCPaths']
for fc in fc_paths:
for wwn in wwns:
if wwn == fc['wwn']:
if wwn.upper() == fc['wwn'].upper():
return host['name']
def terminate_connection(self, volume, hostname, wwn=None, iqn=None):