]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix BrcdFCSANlookupService to iterate multiple switches.
authorAngela Smith <aallen@brocade.com>
Wed, 25 Jun 2014 18:22:27 +0000 (11:22 -0700)
committerAngela Smith <aallen@brocade.com>
Wed, 25 Jun 2014 18:36:18 +0000 (11:36 -0700)
Changed close_connection to client.close_connection.
Fixed return map to key on fabric name instead of principal switch wwn.

Closes-Bug: 1303460
Change-Id: I3725c16cd416a028b85ac8ac6c0d895fd6900763

cinder/tests/zonemanager/test_brcd_fc_san_lookup_service.py
cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py

index f18b440e2a675c001410e23bf48f6d6310bbc604..524c3f3eb6c65761f6a9a4afd2ce0ffab085139d 100644 (file)
@@ -39,7 +39,7 @@ switch_data = [' N 011a00;2,3;20:1a:00:05:1e:e8:e3:29;\
                  20:1a:00:05:1e:e8:e3:29;na']
 nsshow_data = ['10:00:8c:7c:ff:52:3b:01', '20:24:00:02:ac:00:0a:50']
 _device_map_to_verify = {
-    '100000051e55a100': {
+    'BRCD_FAB_2': {
         'initiator_port_wwn_list': ['10008c7cff523b01'],
         'target_port_wwn_list': ['20240002ac000a50']}}
 
index c97c86bdcfcafff39adf16b3d55baf7b03da017d..810d826a236c2c6eb016958bef2a2d2241e53f9e 100644 (file)
@@ -124,9 +124,6 @@ class BrcdFCSanLookupService(FCSanLookupService):
                     'fc_fabric_password')
                 fabric_port = self.fabric_configs[fabric_name].safe_get(
                     'fc_fabric_port')
-                fabric_principal_wwn = \
-                    self.fabric_configs[fabric_name].safe_get(
-                        'principal_switch_wwn')
 
                 # Get name server data from fabric and find the targets
                 # logged in
@@ -148,7 +145,7 @@ class BrcdFCSanLookupService(FCSanLookupService):
                     LOG.error(msg)
                     raise exception.FCSanLookupServiceException(message=msg)
                 finally:
-                    self.close_connection()
+                    self.client.close()
                 LOG.debug("Lookup service:nsinfo-%s", nsinfo)
                 LOG.debug("Lookup service:initiator list from "
                           "caller-%s", formatted_initiator_list)
@@ -182,7 +179,7 @@ class BrcdFCSanLookupService(FCSanLookupService):
                     'initiator_port_wwn_list': visible_initiators,
                     'target_port_wwn_list': visible_targets
                 }
-                device_map[fabric_principal_wwn] = fabric_map
+                device_map[fabric_name] = fabric_map
         LOG.debug("Device map for SAN context: %s", device_map)
         return device_map
 
@@ -211,11 +208,6 @@ class BrcdFCSanLookupService(FCSanLookupService):
         LOG.debug("Connector returning nsinfo-%s", nsinfo_list)
         return nsinfo_list
 
-    def close_connection(self):
-        """This will close the client connection."""
-        self.client.close()
-        self.client = None
-
     def _get_switch_data(self, cmd):
         stdin, stdout, stderr = None, None, None
         utils.check_ssh_injection([cmd])