]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Return all target_wwpns for FC storwize
authorYucong Feng <yfeng@us.ibm.com>
Fri, 19 Feb 2016 21:25:19 +0000 (22:25 +0100)
committerYucong Feng <yfeng@us.ibm.com>
Thu, 25 Feb 2016 18:43:27 +0000 (19:43 +0100)
Storwize FC terminate_connection was using 'lsfabric' to lookup
target_wwpns, active on the fabric, to be used to terminate
the connection. However during a delete of a NPIV VM, the target_wwpns
is no longer active, it is not logged onto the fabric. The target list
will return empty. Fix is to return all the available wwpns
from 'storage_nodes'.

Change-Id: I39897f5583c878cc6243683d4bd60f800ea588af
Closes-Bug: #1546281

cinder/tests/unit/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/storwize_svc_fc.py

index f510da8cf4f77903b165773dce989445353ad868..013bdfa2513ef5fff9bc49ca68acd27e1dabc9f9 100644 (file)
@@ -2292,12 +2292,30 @@ class StorwizeSVCFcDriverTestCase(test.TestCase):
         # Check that the initiator_target_map is as expected
         term_data = {'driver_volume_type': 'fibre_channel',
                      'data': {'initiator_target_map':
-                              {'ff00000000000000': ['AABBCCDDEEFF0011'],
-                               'ff00000000000001': ['AABBCCDDEEFF0011']}
+                              {'ff00000000000000': ['5005076802432ADE',
+                                                    '5005076802332ADE',
+                                                    '5005076802532ADE',
+                                                    '5005076802232ADE',
+                                                    '5005076802132ADE',
+                                                    '5005086802132ADE',
+                                                    '5005086802332ADE',
+                                                    '5005086802532ADE',
+                                                    '5005086802232ADE',
+                                                    '5005086802432ADE'],
+                               'ff00000000000001': ['5005076802432ADE',
+                                                    '5005076802332ADE',
+                                                    '5005076802532ADE',
+                                                    '5005076802232ADE',
+                                                    '5005076802132ADE',
+                                                    '5005086802132ADE',
+                                                    '5005086802332ADE',
+                                                    '5005086802532ADE',
+                                                    '5005086802232ADE',
+                                                    '5005086802432ADE']}
                               }
                      }
 
-        self.assertEqual(term_data, term_ret)
+        self.assertItemsEqual(term_data, term_ret)
 
     def test_storwize_svc_fc_host_maps(self):
         # Create two volumes to be used in mappings
index d9f163eeb22d4c9a948664e207491ae5b8ecc226..762c98cc14bedaa9e96f08e85c476277ac446900 100644 (file)
@@ -291,7 +291,12 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
                              "target map."))
                 # Build info data structure for zone removing
                 if 'wwpns' in connector and host_name:
-                    target_wwpns = self._helpers.get_conn_fc_wwpns(host_name)
+                    target_wwpns = []
+                    # Returning all target_wwpns in storage_nodes, since
+                    # we cannot determine which wwpns are logged in during
+                    # a VM deletion.
+                    for node in self._state['storage_nodes'].values():
+                        target_wwpns.extend(node['WWPN'])
                     init_targ_map = (self._make_initiator_target_map
                                      (connector['wwpns'],
                                       target_wwpns))