From 8e0214e28150717612012b768354b489d069dc90 Mon Sep 17 00:00:00 2001 From: Kurt Martin Date: Wed, 17 Feb 2016 13:58:41 -0800 Subject: [PATCH] 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 --- cinder/tests/unit/test_hpe3par.py | 20 ++++++++++++++++++++ cinder/volume/drivers/hpe/hpe_3par_common.py | 5 +++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cinder/tests/unit/test_hpe3par.py b/cinder/tests/unit/test_hpe3par.py index 4cc2c1d1e..3eabe366f 100644 --- a/cinder/tests/unit/test_hpe3par.py +++ b/cinder/tests/unit/test_hpe3par.py @@ -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 diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 4d0d060cf..f439697ae 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -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): -- 2.45.2