From 47b2c5395236d9b4dab3fdba112860a7007ab359 Mon Sep 17 00:00:00 2001 From: Liqin Dong Date: Thu, 25 Jan 2018 16:27:10 -0800 Subject: [PATCH] Support fabric specific Cisco FC Zone Name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change in Fibre Channel zone manager Cisco driver allows to use the Fibre Channel fabric level cisco_zone_name_prefix to form the zone name. This is consistent with the "Cisco Fibre Channel Zone Driver – OpenStack Configuration Reference”. Zone_name_prefix will fall back to the one speficied at fc-zone-manager level if it is not specified at the more granular FC fabric level. The existing code takes zone_name_prefix only from the fc-zone-manager configuration. This patch also removes the code that marks Cisco Fibre Channel Zone driver as unsupported and deprecated. Cisco CI has been up and running again since Jan 24, 2018. Thus the change. This patch also contains a minor cleanup in ssh pool. Change-Id: If629dd30ed61829a1e4a56bc2e4401ef1adef2a5 --- .../cisco/cisco_fc_san_lookup_service.py | 2 ++ .../drivers/cisco/cisco_fc_zone_driver.py | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py b/cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py index e81cbba4c15..e3564a4295b 100644 --- a/cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py +++ b/cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py @@ -136,6 +136,8 @@ class CiscoFCSanLookupService(fc_service.FCSanLookupService): LOG.debug("show fcns database for vsan %s", zoning_vsan) nsinfo = self.get_nameserver_info(zoning_vsan) + self.cleanup() + LOG.debug("Lookup service:fcnsdatabase-%s", nsinfo) LOG.debug("Lookup service:initiator list from caller-%s", formatted_initiator_list) diff --git a/cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py b/cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py index 7c7ca1a459c..2ee43983ce8 100644 --- a/cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py +++ b/cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py @@ -75,9 +75,6 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): # ThirdPartySystems wiki name CI_WIKI_NAME = "Cisco_ZM_CI" - # TODO(jsbryant) Remove driver in Rocky if CI is not fixed - SUPPORTED = False - def __init__(self, **kwargs): super(CiscoFCZoneDriver, self).__init__(**kwargs) self.configuration = kwargs.get('configuration', None) @@ -152,6 +149,11 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): 'cisco_zoning_policy') if zoning_policy_fab: zoning_policy = zoning_policy_fab + zone_name_prefix = self.fabric_configs[fabric].safe_get( + 'cisco_zone_name_prefix') + + if not zone_name_prefix: + zone_name_prefix = self.configuration.cisco_zone_name_prefix zoning_vsan = self.fabric_configs[fabric].safe_get('cisco_zoning_vsan') @@ -187,7 +189,7 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): target, host_name, storage_system, - self.configuration.cisco_zone_name_prefix, + zone_name_prefix, SUPPORTED_CHARS)) if (len(cfgmap_from_fabric) == 0 or ( zone_name not in zone_names)): @@ -211,7 +213,7 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): target, host_name, storage_system, - self.configuration.cisco_zone_name_prefix, + zone_name_prefix, SUPPORTED_CHARS)) # If zone exists, then perform an update_zone and add @@ -299,6 +301,11 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): zoning_policy = self.configuration.zoning_policy zoning_policy_fab = self.fabric_configs[fabric].safe_get( 'cisco_zoning_policy') + zone_name_prefix = self.fabric_configs[fabric].safe_get( + 'cisco_zone_name_prefix') + + if not zone_name_prefix: + zone_name_prefix = self.configuration.cisco_zone_name_prefix if zoning_policy_fab: zoning_policy = zoning_policy_fab @@ -341,7 +348,7 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): target, host_name, storage_system, - self.configuration.cisco_zone_name_prefix, + zone_name_prefix, SUPPORTED_CHARS)) LOG.debug("Zone name to del: %s", zone_name) if (len(zone_names) > 0 and (zone_name in zone_names)): @@ -363,7 +370,7 @@ class CiscoFCZoneDriver(fc_zone_driver.FCZoneDriver): target, host_name, storage_system, - self.configuration.cisco_zone_name_prefix, + zone_name_prefix, SUPPORTED_CHARS) # Check if there are zone members leftover after removal if (zone_names and (zone_name in zone_names)):