]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add versioning output for the FC Zone Manager
authorWalter A. Boring IV <walter.boring@hp.com>
Tue, 25 Feb 2014 17:47:01 +0000 (09:47 -0800)
committerGerrit Code Review <review@openstack.org>
Thu, 27 Feb 2014 22:32:10 +0000 (22:32 +0000)
This patch adds log output of the version
information for the Fibre Channel Zone Manager
and it's drivers during volume manager start up.

Change-Id: I7de5159782315f528a25ffdf69a59caebcc46ee7
Closes-Bug: #1284362

cinder/volume/manager.py
cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py
cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py
cinder/zonemanager/drivers/fc_zone_driver.py
cinder/zonemanager/fc_common.py [moved from cinder/zonemanager/drivers/fc_common.py with 91% similarity]
cinder/zonemanager/fc_san_lookup_service.py
cinder/zonemanager/fc_zone_manager.py

index 422de1a8c4e96a3ed179d9d2193ad7ee942c1f84..9a2aa73495408aa8bb99d3af45d992a18e9e868f 100644 (file)
@@ -198,6 +198,8 @@ class VolumeManager(manager.SchedulerDependentManager):
             db=self.db,
             host=self.host)
 
+        self.zonemanager = None
+
     def _add_to_threadpool(self, func, *args, **kwargs):
         self._tp.spawn_n(func, *args, **kwargs)
 
@@ -207,6 +209,14 @@ class VolumeManager(manager.SchedulerDependentManager):
         """
 
         ctxt = context.get_admin_context()
+        if self.configuration.safe_get('zoning_mode') == 'fabric':
+            self.zonemanager = ZoneManager(configuration=self.configuration)
+            LOG.info(_("Starting FC Zone Manager %(zm_version)s,"
+                       " Driver %(drv_name)s %(drv_version)s") %
+                     {'zm_version': self.zonemanager.get_version(),
+                      'drv_name': self.zonemanager.driver.__class__.__name__,
+                      'drv_version': self.zonemanager.driver.get_version()})
+
         LOG.info(_("Starting volume driver %(driver_name)s (%(version)s)") %
                  {'driver_name': self.driver.__class__.__name__,
                   'version': self.driver.get_version()})
@@ -806,7 +816,7 @@ class VolumeManager(manager.SchedulerDependentManager):
         vol_type = conn_info.get('driver_volume_type', None)
         mode = self.configuration.zoning_mode
         LOG.debug(_("Zoning Mode: %s"), mode)
-        if vol_type == 'fibre_channel' and mode == 'fabric':
+        if vol_type == 'fibre_channel' and self.zonemanager:
             self._add_or_delete_fc_connection(conn_info, 1)
         return conn_info
 
@@ -831,7 +841,7 @@ class VolumeManager(manager.SchedulerDependentManager):
                 vol_type = conn_info.get('driver_volume_type', None)
                 mode = self.configuration.zoning_mode
                 LOG.debug(_("Zoning Mode: %s"), mode)
-                if vol_type == 'fibre_channel' and mode == 'fabric':
+                if vol_type == 'fibre_channel' and self.zonemanager:
                     self._add_or_delete_fc_connection(conn_info, 0)
         except Exception as err:
             err_msg = (_('Unable to terminate volume connection: %(err)s')
@@ -1265,14 +1275,11 @@ class VolumeManager(manager.SchedulerDependentManager):
         # target WWN is passed to ZoneManager to add or update zone config.
         LOG.debug(_("Zoning op: %s"), zone_op)
         if _initiator_target_map is not None:
-            kwargs = {'driver_volume_type': 'fibre_channel',
-                      'configuration': self.configuration}
-            zonemanager = ZoneManager(**kwargs)
             try:
                 if zone_op == 1:
-                    zonemanager.add_connection(_initiator_target_map)
+                    self.zonemanager.add_connection(_initiator_target_map)
                 elif zone_op == 0:
-                    zonemanager.delete_connection(_initiator_target_map)
+                    self.zonemanager.delete_connection(_initiator_target_map)
             except exception.ZoneManagerException as e:
                 with excutils.save_and_reraise_exception():
                     LOG.error(str(e))
index 032adb18d980c086d7e327d0ce9d4608e25fde80..6fb112dcd62a22a596b2a2af78ddd94d20b266f8 100644 (file)
@@ -25,12 +25,20 @@ from cinder.openstack.common import log as logging
 from cinder import utils
 from cinder.zonemanager.drivers.brocade import brcd_fabric_opts as fabric_opts
 import cinder.zonemanager.drivers.brocade.fc_zone_constants as ZoneConstant
-from cinder.zonemanager.drivers.fc_common import FCCommon
+from cinder.zonemanager.fc_san_lookup_service import FCSanLookupService
 
 LOG = logging.getLogger(__name__)
 
 
-class BrcdFCSanLookupService(FCCommon):
+class BrcdFCSanLookupService(FCSanLookupService):
+    """The SAN lookup service that talks to Brocade switches.
+
+    Version History:
+        1.0.0 - Initial version
+
+    """
+
+    VERSION = "1.0.0"
 
     def __init__(self, **kwargs):
         """Initializing the client."""
index bda2f1d29efe983b8bf4de92af26996859fcc677..5cb59ccb1e28645ec5d1fc1e9c928baccd3b182a 100644 (file)
@@ -63,6 +63,8 @@ class BrcdFCZoneDriver(FCZoneDriver):
         1.0 - Initial Brocade FC zone driver
     """
 
+    VERSION = "1.0"
+
     def __init__(self, **kwargs):
         super(BrcdFCZoneDriver, self).__init__(**kwargs)
         self.configuration = kwargs.get('configuration', None)
index 9254bd212afc776e0d6e1ea4f0f9f22126f8ecb7..11985ebe5092b0a2738988c344aa98e2eb259125 100644 (file)
@@ -31,12 +31,12 @@ interfaces.
 
 
 from cinder.openstack.common import log as logging
-from cinder.zonemanager.drivers.fc_common import FCCommon
+from cinder.zonemanager import fc_common
 
 LOG = logging.getLogger(__name__)
 
 
-class FCZoneDriver(FCCommon):
+class FCZoneDriver(fc_common.FCCommon):
     """Interface to manage Connection control during attach/detach."""
 
     def __init__(self, **kwargs):
similarity index 91%
rename from cinder/zonemanager/drivers/fc_common.py
rename to cinder/zonemanager/fc_common.py
index 984cdb63ff0582602492f565f3fbd84843f0b114..61b415da2d75960e0a0b153fb90af2d107e4000d 100644 (file)
 class FCCommon(object):
     """Common interface for FC operations."""
 
+    VERSION = "1.0"
+
     def __init__(self, **kwargs):
         pass
+
+    def get_version(self):
+        return self.VERSION
index 147b76bd2d03b808d6ca55ce145c2143e6532e80..5a76c1364e3abde71a1fa5ae3022603df445162c 100644 (file)
@@ -20,6 +20,7 @@ Base Lookup Service for name server lookup to find the initiator to target port
 mapping for available SAN contexts.
 Vendor specific lookup classes are expected to implement the interfaces
 defined in this class.
+
 """
 
 
@@ -27,22 +28,26 @@ from cinder import exception
 from cinder.openstack.common import importutils
 from cinder.openstack.common import log as logging
 from cinder.volume import configuration as config
+from cinder.zonemanager import fc_common
 from cinder.zonemanager import fc_zone_manager
 
 
 LOG = logging.getLogger(__name__)
 
 
-class FCSanLookupService(object):
+class FCSanLookupService(fc_common.FCCommon):
     """Base Lookup Service.
 
     Base Lookup Service for name server lookup to find the initiator to
     target port mapping for available SAN contexts.
+
     """
 
     lookup_service = None
 
     def __init__(self, **kwargs):
+        super(FCSanLookupService, self).__init__(**kwargs)
+
         self.configuration = kwargs.get('configuration', None)
 
         opts = fc_zone_manager.zone_manager_opts
index dd938524709f08c939ff7438cd0485cb6ecd292a..0dc91d12faf7712180ef8d42c2b9526dd8e9a937 100644 (file)
@@ -38,6 +38,7 @@ from cinder import exception
 from cinder.openstack.common import importutils
 from cinder.openstack.common import log as logging
 from cinder.volume import configuration as config
+from cinder.zonemanager import fc_common
 
 LOG = logging.getLogger(__name__)
 
@@ -64,14 +65,16 @@ CONF = cfg.CONF
 CONF.register_opts(zone_manager_opts, 'fc-zone-manager')
 
 
-class ZoneManager:
+class ZoneManager(fc_common.FCCommon):
     """Manages Connection control during attach/detach."""
 
+    VERSION = "1.0"
     driver = None
     fabric_names = []
 
     def __init__(self, **kwargs):
         """Load the driver from the one specified in args, or from flags."""
+        super(ZoneManager, self).__init__(**kwargs)
 
         self.configuration = kwargs.get('configuration', None)
         if self.configuration: