From: Walter A. Boring IV <walter.boring@hp.com>
Date: Tue, 24 Feb 2015 16:23:03 +0000 (-0800)
Subject: FCZM fix reading of cinder config entries
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ef63d75db7181a79933b207fbb1ba8b0e7a1c0a7;p=openstack-build%2Fcinder-build.git

FCZM fix reading of cinder config entries

The zone manager and the lookup service had some cruft code that
was incorrectly reading the cinder.conf sections it needed.
When cinder.conf was configured to use the Cisco driver, the zone
manager would never see it, because it was reading from the wrong
section of cinder.conf.

Change-Id: I4a48bc39e55d4b7e9a149a3ec3aa3947980360ea
Closes-Bug: 1424852
---

diff --git a/cinder/zonemanager/fc_san_lookup_service.py b/cinder/zonemanager/fc_san_lookup_service.py
index 99acc84c8..f35c8576f 100644
--- a/cinder/zonemanager/fc_san_lookup_service.py
+++ b/cinder/zonemanager/fc_san_lookup_service.py
@@ -49,8 +49,6 @@ class FCSanLookupService(fc_common.FCCommon):
     def __init__(self, **kwargs):
         super(FCSanLookupService, self).__init__(**kwargs)
 
-        self.configuration = kwargs.get('configuration', None)
-
         opts = fc_zone_manager.zone_manager_opts
         self.configuration = config.Configuration(opts, 'fc-zone-manager')
 
diff --git a/cinder/zonemanager/fc_zone_manager.py b/cinder/zonemanager/fc_zone_manager.py
index f508cc519..5108135b8 100644
--- a/cinder/zonemanager/fc_zone_manager.py
+++ b/cinder/zonemanager/fc_zone_manager.py
@@ -88,9 +88,8 @@ class ZoneManager(fc_common.FCCommon):
         """Load the driver from the one specified in args, or from flags."""
         super(ZoneManager, self).__init__(**kwargs)
 
-        self.configuration = kwargs.get('configuration')
-        if self.configuration:
-            self.configuration.append_config_values(zone_manager_opts)
+        self.configuration = config.Configuration(zone_manager_opts,
+                                                  'fc-zone-manager')
 
         self._build_driver()
 
@@ -98,11 +97,10 @@ class ZoneManager(fc_common.FCCommon):
         zone_driver = self.configuration.zone_driver
         LOG.debug("Zone Driver from config: {%s}", zone_driver)
 
-        zm_config = config.Configuration(zone_manager_opts, 'fc-zone-manager')
         # Initialize vendor specific implementation of  FCZoneDriver
         self.driver = importutils.import_object(
             zone_driver,
-            configuration=zm_config)
+            configuration=self.configuration)
 
     def get_zoning_state_ref_count(self, initiator_wwn, target_wwn):
         """Zone management state check.
diff --git a/cinder/zonemanager/utils.py b/cinder/zonemanager/utils.py
index fb2dba525..2268fa10a 100644
--- a/cinder/zonemanager/utils.py
+++ b/cinder/zonemanager/utils.py
@@ -36,7 +36,7 @@ def create_zone_manager():
     LOG.debug("Zoning mode: %s", config.safe_get('zoning_mode'))
     if config.safe_get('zoning_mode') == 'fabric':
         LOG.debug("FC Zone Manager enabled.")
-        zm = fc_zone_manager.ZoneManager(configuration=config)
+        zm = fc_zone_manager.ZoneManager()
         LOG.info(_LI("Using FC Zone Manager %(zm_version)s,"
                      " Driver %(drv_name)s %(drv_version)s."),
                  {'zm_version': zm.get_version(),
@@ -53,7 +53,7 @@ def create_lookup_service():
     LOG.debug("Zoning mode: %s", config.safe_get('zoning_mode'))
     if config.safe_get('zoning_mode') == 'fabric':
         LOG.debug("FC Lookup Service enabled.")
-        lookup = fc_san_lookup_service.FCSanLookupService(configuration=config)
+        lookup = fc_san_lookup_service.FCSanLookupService()
         LOG.info(_LI("Using FC lookup service %s"), lookup.lookup_service)
         return lookup
     else: