From: Walter A. Boring IV Date: Tue, 25 Feb 2014 17:47:01 +0000 (-0800) Subject: Add versioning output for the FC Zone Manager X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=65e1031c6aeaf4d88029e33694c0c32ef81e75a6;p=openstack-build%2Fcinder-build.git Add versioning output for the FC Zone Manager 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 --- diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 422de1a8c..9a2aa7349 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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)) diff --git a/cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py b/cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py index 032adb18d..6fb112dcd 100644 --- a/cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py +++ b/cinder/zonemanager/drivers/brocade/brcd_fc_san_lookup_service.py @@ -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.""" diff --git a/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py b/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py index bda2f1d29..5cb59ccb1 100644 --- a/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py +++ b/cinder/zonemanager/drivers/brocade/brcd_fc_zone_driver.py @@ -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) diff --git a/cinder/zonemanager/drivers/fc_zone_driver.py b/cinder/zonemanager/drivers/fc_zone_driver.py index 9254bd212..11985ebe5 100644 --- a/cinder/zonemanager/drivers/fc_zone_driver.py +++ b/cinder/zonemanager/drivers/fc_zone_driver.py @@ -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): diff --git a/cinder/zonemanager/drivers/fc_common.py b/cinder/zonemanager/fc_common.py similarity index 91% rename from cinder/zonemanager/drivers/fc_common.py rename to cinder/zonemanager/fc_common.py index 984cdb63f..61b415da2 100644 --- a/cinder/zonemanager/drivers/fc_common.py +++ b/cinder/zonemanager/fc_common.py @@ -20,5 +20,10 @@ class FCCommon(object): """Common interface for FC operations.""" + VERSION = "1.0" + def __init__(self, **kwargs): pass + + def get_version(self): + return self.VERSION diff --git a/cinder/zonemanager/fc_san_lookup_service.py b/cinder/zonemanager/fc_san_lookup_service.py index 147b76bd2..5a76c1364 100644 --- a/cinder/zonemanager/fc_san_lookup_service.py +++ b/cinder/zonemanager/fc_san_lookup_service.py @@ -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 diff --git a/cinder/zonemanager/fc_zone_manager.py b/cinder/zonemanager/fc_zone_manager.py index dd9385247..0dc91d12f 100644 --- a/cinder/zonemanager/fc_zone_manager.py +++ b/cinder/zonemanager/fc_zone_manager.py @@ -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: