Rename AddFCZone and RemoveFCZone according to PEP 8

The project adheres to PEP 8, so decorators should be named
with underscores (like functions) and not with upper camel
case (like classes)

Change-Id: Ifa38e5d327c2b1a2cdd77ceb2cbc2a9be468bce8
This commit is contained in:
Arnon Yaari 2017-01-09 11:21:24 +02:00
parent 7502e1fed3
commit e01f24fe3b
32 changed files with 68 additions and 68 deletions

View File

@ -163,7 +163,7 @@ class FakeISERDriver(FakeLoggingVolumeDriver):
class FakeFibreChannelDriver(driver.FibreChannelDriver):
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
return {
'driver_volume_type': 'fibre_channel',
@ -171,7 +171,7 @@ class FakeFibreChannelDriver(driver.FibreChannelDriver):
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
}}
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def no_zone_initialize_connection(self, volume, connector):
"""This shouldn't call the ZM."""
return {
@ -180,7 +180,7 @@ class FakeFibreChannelDriver(driver.FibreChannelDriver):
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
}}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
return {
'driver_volume_type': 'fibre_channel',
@ -188,7 +188,7 @@ class FakeFibreChannelDriver(driver.FibreChannelDriver):
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
}}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def no_zone_terminate_connection(self, volume, connector, **kwargs):
return {
'driver_volume_type': 'bogus',

View File

@ -118,7 +118,7 @@ class EMCCoprHDFCDriver(driver.FibreChannelDriver):
"""Make sure volume is exported."""
pass
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info."""
@ -157,7 +157,7 @@ class EMCCoprHDFCDriver(driver.FibreChannelDriver):
'data': properties,
}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Driver entry point to detach a volume from an instance."""

View File

@ -69,7 +69,7 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
self.configuration.safe_get('volume_backend_name') or 'Dell-FC'
self.storage_protocol = 'FC'
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info.
@ -188,7 +188,7 @@ class DellStorageCenterFCDriver(dell_storagecenter_common.DellCommonDriver,
'wwns': wwns})
return None, [], {}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, force=False, **kwargs):
# Get our volume name
volume_name = volume.get('id')

View File

@ -117,7 +117,7 @@ class UnityDriver(driver.TransferVD,
"""Make sure volume is exported."""
pass
@zm_utils.AddFCZone
@zm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info.
@ -165,7 +165,7 @@ class UnityDriver(driver.TransferVD,
{'conn_info': conn_info})
return conn_info
@zm_utils.RemoveFCZone
@zm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector."""
LOG.debug("Entering terminate_connection"

View File

@ -152,7 +152,7 @@ class VNXDriver(driver.TransferVD,
"""Make sure volume is exported."""
pass
@zm_utils.AddFCZone
@zm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info.
@ -200,7 +200,7 @@ class VNXDriver(driver.TransferVD,
{'conn_info': conn_info})
return conn_info
@zm_utils.RemoveFCZone
@zm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector."""
LOG.debug("Entering terminate_connection"

View File

@ -987,7 +987,7 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
seq = range(len(uniq_luns) + 1)
return min(set(seq) - uniq_luns)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
wwpns = self._get_initiator_names(connector)
ig_name = self._get_ig_name(connector)
@ -1028,7 +1028,7 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
'target_wwn': self.get_targets(),
'initiator_target_map': i_t_map}}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
(super(XtremIOFCDriver, self)
.terminate_connection(volume, connector, **kwargs))

View File

@ -82,7 +82,7 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
def delete_volume(self, volume):
self.common.delete_volume(volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
self.common.client_login()
try:
@ -101,7 +101,7 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
finally:
self.common.client_logout()
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
self.common.unmap_volume(volume, connector, 'wwpns')
info = {'driver_volume_type': 'fibre_channel', 'data': {}}

View File

@ -155,7 +155,7 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
"""Make sure volume is exported."""
pass
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info.
@ -217,7 +217,7 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
return data
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector.

View File

@ -75,7 +75,7 @@ class FSSFCDriver(fss_common.FalconstorBaseDriver,
'information.'))
raise exception.InvalidConnectorException(missing='wwpns')
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
fss_hosts = []
fss_hosts.append(self.configuration.san_ip)
@ -99,7 +99,7 @@ class FSSFCDriver(fss_common.FalconstorBaseDriver,
init_targ_map = dict.fromkeys(initiator_wwns, self.gateway_fc_wwns)
return init_targ_map
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
host_id = self.proxy.fc_terminate_connection(volume, connector)
fc_info = {"driver_volume_type": "fibre_channel", "data": {}}

View File

@ -142,7 +142,7 @@ class FJDXFCDriver(driver.FibreChannelDriver):
"""Driver entry point to remove an export for a volume."""
return
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Allow connection to connector and return connection info."""
LOG.debug('initialize_connection, volume id: %(vid)s, '
@ -161,7 +161,7 @@ class FJDXFCDriver(driver.FibreChannelDriver):
'info: %s, exit method.', info)
return info
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector."""
LOG.debug('terminate_connection, volume id: %(vid)s, '

View File

@ -409,7 +409,7 @@ class HBSDFCDriver(cinder.volume.driver.FibreChannelDriver):
return hostgroups
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
self.do_setup_status.wait()
ldev = self.common.get_ldev(volume)
@ -437,7 +437,7 @@ class HBSDFCDriver(cinder.volume.driver.FibreChannelDriver):
self._delete_lun(hostgroups, ldev)
LOG.debug("*** _terminate_ ***")
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
self.do_setup_status.wait()
ldev = self.common.get_ldev(volume)

View File

@ -163,7 +163,7 @@ class VSPHORCMFC(horcm.VSPHORCM):
return nr_not_found
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initialize connection between the server and the volume."""
conn_info = super(VSPHORCMFC, self).initialize_connection(
@ -172,7 +172,7 @@ class VSPHORCMFC(horcm.VSPHORCM):
utils.update_conn_info(conn_info, connector, self._lookup_service)
return conn_info
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector):
"""Terminate connection between the server and the volume."""
conn_info = super(VSPHORCMFC, self).terminate_connection(

View File

@ -243,7 +243,7 @@ class HPE3PARFCDriver(driver.TransferVD,
self._logout(common)
@utils.trace
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Assigns the volume to a server.
@ -366,7 +366,7 @@ class HPE3PARFCDriver(driver.TransferVD,
self._logout(common)
@utils.trace
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Driver entry point to unattach a volume from an instance."""
common = self._login()

View File

@ -162,13 +162,13 @@ class HPEXPFCDriver(driver.FibreChannelDriver):
pass
@utils.trace
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Attach the volume to an instance."""
return self.common.initialize_connection(volume, connector)
@utils.trace
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Detach a volume from an instance."""
return self.common.terminate_connection(volume, connector, **kwargs)

View File

@ -2111,7 +2111,7 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
return data
@utils.synchronized('huawei', external=True)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
lun_id, lun_type = self.get_lun_id_and_type(volume)
wwns = connector['wwpns']
@ -2252,7 +2252,7 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
return same_host_id
@utils.synchronized('huawei', external=True)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Delete map between a volume and a host."""
lun_id, lun_type = self.get_lun_id_and_type(volume)

View File

@ -258,7 +258,7 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
return {'driver_volume_type': type_str, 'data': properties}
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
@utils.synchronized('flashsystem-init-conn', external=True)
def initialize_connection(self, volume, connector):
"""Perform work so that an FC connection can be made.
@ -317,7 +317,7 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
return properties
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
@utils.synchronized('flashsystem-term-conn', external=True)
def terminate_connection(self, volume, connector, **kwargs):
"""Cleanup after connection has been terminated.

View File

@ -137,13 +137,13 @@ class IBMStorageDriver(san.SanDriver,
return self.proxy.remove_export(context, volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Map the created volume."""
return self.proxy.initialize_connection(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Terminate a connection to a volume."""

View File

@ -109,7 +109,7 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
raise exception.InvalidConnectorException(
missing='wwpns')
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Perform necessary work to make a FC connection."""
@utils.synchronized('storwize-host' + self._state['system_id'] +
@ -233,7 +233,7 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
return i_t_map
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Cleanup after an FC connection has been terminated."""
# If a fake connector is generated by nova when the host

View File

@ -199,7 +199,7 @@ class InfiniboxVolumeDriver(san.SanDriver,
and port['state'] == 'OK'):
yield self._cleanup_wwpn(port['wwpn'])
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Map an InfiniBox volume to the host"""
volume_name = self._make_volume_name(volume)
@ -220,7 +220,7 @@ class InfiniboxVolumeDriver(san.SanDriver,
target_lun=lun,
initiator_target_map=init_target_map))
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Unmap an InfiniBox volume from the host"""
volume_id = self._get_infinidat_volume_id(volume)

View File

@ -145,7 +145,7 @@ class InfortrendCLIFCDriver(driver.FibreChannelDriver):
"""Removes an export for a volume."""
pass
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection information.
@ -193,7 +193,7 @@ class InfortrendCLIFCDriver(driver.FibreChannelDriver):
'initiator': connector['initiator']})
return self.common.initialize_connection(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector."""
LOG.debug('terminate_connection volume id=%(volume_id)s', {

View File

@ -51,7 +51,7 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
self._protocol = 'FC'
self.lookup_service = fczm_utils.create_lookup_service()
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
@kaminario_logger
@coordination.synchronized('{self.k2_lock_name}')
def initialize_connection(self, volume, connector):
@ -84,7 +84,7 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
"target_wwn": target_wwpns,
"initiator_target_map": init_target_map}}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
@kaminario_logger
@coordination.synchronized('{self.k2_lock_name}')
def terminate_connection(self, volume, connector, **kwargs):

View File

@ -67,10 +67,10 @@ class MStorageFCDriver(volume_helper.MStorageDSVDriver,
def get_volume_stats(self, refresh=False):
return self.fc_get_volume_stats(refresh)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
return self.fc_initialize_connection(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
return self.fc_terminate_connection(volume, connector)

View File

@ -98,11 +98,11 @@ class NetApp7modeFibreChannelDriver(driver.BaseVD,
def unmanage(self, volume):
return self.library.unmanage(volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
return self.library.initialize_connection_fc(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
return self.library.terminate_connection_fc(volume, connector,
**kwargs)

View File

@ -98,11 +98,11 @@ class NetAppCmodeFibreChannelDriver(driver.BaseVD,
def unmanage(self, volume):
return self.library.unmanage(volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
return self.library.initialize_connection_fc(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
return self.library.terminate_connection_fc(volume, connector,
**kwargs)

View File

@ -92,11 +92,11 @@ class NetAppEseriesFibreChannelDriver(driver.BaseVD,
def unmanage(self, volume):
return self.library.unmanage(volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector, **kwargs):
return self.library.initialize_connection_fc(volume, connector)
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
return self.library.terminate_connection_fc(volume, connector,
**kwargs)

View File

@ -836,7 +836,7 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
return init_targ_map
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Driver entry point to attach a volume to an instance."""
LOG.info(_LI('Entering initialize_connection volume=%(vol)s'
@ -878,7 +878,7 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
return data
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Driver entry point to unattach a volume from an instance."""
LOG.info(_LI('Entering terminate_connection volume=%(vol)s'

View File

@ -218,7 +218,7 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
return init_targ_map
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Allow connection to connector and return connection info."""
"""
@ -339,7 +339,7 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
return {'driver_volume_type': 'fibre_channel',
'data': properties}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Disallow connection from connector."""
"""

View File

@ -1774,7 +1774,7 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
ports = array.list_ports()
return [port["wwn"] for port in ports if port["wwn"]]
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
@pure_driver_debug_trace
def initialize_connection(self, volume, connector):
"""Allow connection to connector and return connection info."""
@ -1851,7 +1851,7 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
return init_targ_map
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
@pure_driver_debug_trace
def terminate_connection(self, volume, connector, **kwargs):
"""Terminate connection."""

View File

@ -598,7 +598,7 @@ class TegileFCDriver(TegileIntelliFlashVolumeDriver,
def do_setup(self, context):
super(TegileFCDriver, self).do_setup(context)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
@debugger
def initialize_connection(self, volume, connector):
"""Initializes the connection and returns connection info."""
@ -631,7 +631,7 @@ class TegileFCDriver(TegileIntelliFlashVolumeDriver,
return connection_data
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
@debugger
def terminate_connection(self, volume, connector, force=False, **kwargs):

View File

@ -135,7 +135,7 @@ class V7000FCPDriver(driver.FibreChannelDriver):
"""Removes an export for a logical volume."""
pass
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
"""Allow connection to connector and return connection info."""
@ -164,7 +164,7 @@ class V7000FCPDriver(driver.FibreChannelDriver):
return {'driver_volume_type': 'fibre_channel', 'data': properties}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
"""Terminates the connection (target<-->initiator)."""

View File

@ -1571,7 +1571,7 @@ class XIOISEFCDriver(driver.FibreChannelDriver):
def unmanage(self, volume):
return self.driver.unmanage(volume)
@fczm_utils.AddFCZone
@fczm_utils.add_fc_zone
def initialize_connection(self, volume, connector):
hostname = ''
if 'host' in connector:
@ -1589,7 +1589,7 @@ class XIOISEFCDriver(driver.FibreChannelDriver):
return {'driver_volume_type': 'fibre_channel',
'data': data}
@fczm_utils.RemoveFCZone
@fczm_utils.remove_fc_zone
def terminate_connection(self, volume, connector, **kwargs):
# now we are ready to tell ISE to delete presentations
hostname = self.driver.ise_unpresent(volume, connector['wwpns'])

View File

@ -74,7 +74,7 @@ def get_formatted_wwn(wwn_str):
for i in range(0, len(wwn_str), 2)])).lower()
def AddFCZone(initialize_connection):
def add_fc_zone(initialize_connection):
"""Decorator to add a FC Zone."""
def decorator(self, *args, **kwargs):
@ -89,7 +89,7 @@ def AddFCZone(initialize_connection):
if 'initiator_target_map' in conn_info['data']:
zm = create_zone_manager()
if zm:
LOG.debug("AddFCZone connection info: %(conninfo)s.",
LOG.debug("add_fc_zone connection info: %(conninfo)s.",
{'conninfo': conn_info})
zm.add_connection(conn_info)
@ -98,7 +98,7 @@ def AddFCZone(initialize_connection):
return decorator
def RemoveFCZone(terminate_connection):
def remove_fc_zone(terminate_connection):
"""Decorator for FC drivers to remove zone."""
def decorator(self, *args, **kwargs):
@ -113,7 +113,7 @@ def RemoveFCZone(terminate_connection):
if 'initiator_target_map' in conn_info['data']:
zm = create_zone_manager()
if zm:
LOG.debug("RemoveFCZone connection info: %(conninfo)s.",
LOG.debug("remove_fc_zone connection info: %(conninfo)s.",
{'conninfo': conn_info})
zm.delete_connection(conn_info)