]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
3PAR get host by WWN now handles mixed cases
authorKurt Martin <kurt.f.martin@hp.com>
Wed, 17 Feb 2016 21:58:41 +0000 (13:58 -0800)
committerKurt Martin <kurt.f.martin@hp.com>
Fri, 19 Feb 2016 16:04:09 +0000 (08:04 -0800)
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
cinder/volume/drivers/hpe/hpe_3par_common.py

index 4cc2c1d1eb5bd7b0e1c314f832ceca764585b373..3eabe366f0f879ecf439d57a4f45082a69767b45 100644 (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
index 4d0d060cf2404bb4138b2206cbc63c585b41fb76..f439697aea325d8d675c8d6426839f24c26c4c02 100644 (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):