db=self.db,
host=self.host)
+ self.zonemanager = None
+
def _add_to_threadpool(self, func, *args, **kwargs):
self._tp.spawn_n(func, *args, **kwargs)
"""
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()})
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
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')
# 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))
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."""
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)
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):
class FCCommon(object):
"""Common interface for FC operations."""
+ VERSION = "1.0"
+
def __init__(self, **kwargs):
pass
+
+ def get_version(self):
+ return self.VERSION
mapping for available SAN contexts.
Vendor specific lookup classes are expected to implement the interfaces
defined in this class.
+
"""
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
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__)
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: