FC: refactor fczm utils decorators to functions
This patch changes the Fibre Channel Zone Manager utility decorators to functions. Those functions now have to be called manually. The intention of this is to unify how the FC drivers are to be declared and used vs. the iSCSI. No more magic decorators for FC drivers only. Change-Id: I8e6e964e3694654b8ba93fe432a0dd49fa5e1df0
This commit is contained in:
parent
e6028249cc
commit
3b28cb2a10
@ -240,38 +240,42 @@ class FakeISERDriver(FakeLoggingVolumeDriver):
|
|||||||
|
|
||||||
class FakeFibreChannelDriver(driver.FibreChannelDriver):
|
class FakeFibreChannelDriver(driver.FibreChannelDriver):
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
return {
|
conn_info = {
|
||||||
'driver_volume_type': 'fibre_channel',
|
'driver_volume_type': 'fibre_channel',
|
||||||
'data': {
|
'data': {
|
||||||
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
||||||
}}
|
}}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def no_zone_initialize_connection(self, volume, connector):
|
def no_zone_initialize_connection(self, volume, connector):
|
||||||
"""This shouldn't call the ZM."""
|
"""This shouldn't call the ZM."""
|
||||||
return {
|
conn_info = {
|
||||||
'driver_volume_type': 'bogus',
|
'driver_volume_type': 'bogus',
|
||||||
'data': {
|
'data': {
|
||||||
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
||||||
}}
|
}}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
return {
|
conn_info = {
|
||||||
'driver_volume_type': 'fibre_channel',
|
'driver_volume_type': 'fibre_channel',
|
||||||
'data': {
|
'data': {
|
||||||
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
||||||
}}
|
}}
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def no_zone_terminate_connection(self, volume, connector, **kwargs):
|
def no_zone_terminate_connection(self, volume, connector, **kwargs):
|
||||||
return {
|
conn_info = {
|
||||||
'driver_volume_type': 'bogus',
|
'driver_volume_type': 'bogus',
|
||||||
'data': {
|
'data': {
|
||||||
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
'initiator_target_map': {'fake_wwn': ['fake_wwn2']},
|
||||||
}}
|
}}
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
|
|
||||||
class FakeGateDriver(lvm.LVMVolumeDriver):
|
class FakeGateDriver(lvm.LVMVolumeDriver):
|
||||||
|
@ -159,7 +159,6 @@ class EMCCoprHDFCDriver(driver.FibreChannelDriver):
|
|||||||
"""Make sure volume is exported."""
|
"""Make sure volume is exported."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Initializes the connection and returns connection info."""
|
"""Initializes the connection and returns connection info."""
|
||||||
|
|
||||||
@ -196,12 +195,13 @@ class EMCCoprHDFCDriver(driver.FibreChannelDriver):
|
|||||||
properties['auth_password'] = auth_secret
|
properties['auth_password'] = auth_secret
|
||||||
|
|
||||||
LOG.debug('FC properties: %s', properties)
|
LOG.debug('FC properties: %s', properties)
|
||||||
return {
|
conn_info = {
|
||||||
'driver_volume_type': 'fibre_channel',
|
'driver_volume_type': 'fibre_channel',
|
||||||
'data': properties,
|
'data': properties,
|
||||||
}
|
}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Driver entry point to detach a volume from an instance."""
|
"""Driver entry point to detach a volume from an instance."""
|
||||||
|
|
||||||
@ -221,6 +221,7 @@ class EMCCoprHDFCDriver(driver.FibreChannelDriver):
|
|||||||
'data': {
|
'data': {
|
||||||
'target_wwn': target_wwns,
|
'target_wwn': target_wwns,
|
||||||
'initiator_target_map': initiator_target_map}}
|
'initiator_target_map': initiator_target_map}}
|
||||||
|
fczm_utils.remove_fc_zone(data)
|
||||||
|
|
||||||
LOG.debug('Return FC data: %s', data)
|
LOG.debug('Return FC data: %s', data)
|
||||||
return data
|
return data
|
||||||
|
@ -76,7 +76,14 @@ class SCFCDriver(storagecenter_common.SCCommonDriver,
|
|||||||
self.configuration.safe_get('volume_backend_name') or 'Dell-FC'
|
self.configuration.safe_get('volume_backend_name') or 'Dell-FC'
|
||||||
self.storage_protocol = 'FC'
|
self.storage_protocol = 'FC'
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
def validate_connector(self, connector):
|
||||||
|
"""Fail if connector doesn't contain all the data needed by driver.
|
||||||
|
|
||||||
|
Do a check on the connector and ensure that it has wwnns, wwpns.
|
||||||
|
"""
|
||||||
|
self.validate_connector_has_setting(connector, 'wwpns')
|
||||||
|
self.validate_connector_has_setting(connector, 'wwnns')
|
||||||
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Initializes the connection and returns connection info.
|
"""Initializes the connection and returns connection info.
|
||||||
|
|
||||||
@ -148,6 +155,7 @@ class SCFCDriver(storagecenter_common.SCCommonDriver,
|
|||||||
init_targ_map,
|
init_targ_map,
|
||||||
'discard': True}}
|
'discard': True}}
|
||||||
LOG.debug('Return FC data: %s', data)
|
LOG.debug('Return FC data: %s', data)
|
||||||
|
fczm_utils.add_fc_zone(data)
|
||||||
return data
|
return data
|
||||||
LOG.error('Lun mapping returned null!')
|
LOG.error('Lun mapping returned null!')
|
||||||
|
|
||||||
@ -231,7 +239,6 @@ class SCFCDriver(storagecenter_common.SCCommonDriver,
|
|||||||
'data': {}}
|
'data': {}}
|
||||||
return info
|
return info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, force=False, **kwargs):
|
def terminate_connection(self, volume, connector, force=False, **kwargs):
|
||||||
# Special case
|
# Special case
|
||||||
if connector is None:
|
if connector is None:
|
||||||
@ -293,6 +300,7 @@ class SCFCDriver(storagecenter_common.SCCommonDriver,
|
|||||||
if scserver and api.get_volume_count(scserver) == 0:
|
if scserver and api.get_volume_count(scserver) == 0:
|
||||||
info['data'] = {'target_wwn': targets,
|
info['data'] = {'target_wwn': targets,
|
||||||
'initiator_target_map': init_targ_map}
|
'initiator_target_map': init_targ_map}
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
return info
|
return info
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -122,7 +122,6 @@ class UnityDriver(driver.ManageableVD,
|
|||||||
"""Make sure volume is exported."""
|
"""Make sure volume is exported."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@zm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Initializes the connection and returns connection info.
|
"""Initializes the connection and returns connection info.
|
||||||
|
|
||||||
@ -168,12 +167,15 @@ class UnityDriver(driver.ManageableVD,
|
|||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.adapter.initialize_connection(volume, connector)
|
conn_info = self.adapter.initialize_connection(volume, connector)
|
||||||
|
zm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@zm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Disallow connection from connector."""
|
"""Disallow connection from connector."""
|
||||||
return self.adapter.terminate_connection(volume, connector)
|
conn_info = self.adapter.terminate_connection(volume, connector)
|
||||||
|
zm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def get_volume_stats(self, refresh=False):
|
def get_volume_stats(self, refresh=False):
|
||||||
"""Get volume stats.
|
"""Get volume stats.
|
||||||
|
@ -198,7 +198,6 @@ class VMAXFCDriver(san.SanDriver, driver.FibreChannelDriver):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Initializes the connection and returns connection info.
|
"""Initializes the connection and returns connection info.
|
||||||
|
|
||||||
@ -239,7 +238,9 @@ class VMAXFCDriver(san.SanDriver, driver.FibreChannelDriver):
|
|||||||
device_info = self.common.initialize_connection(
|
device_info = self.common.initialize_connection(
|
||||||
volume, connector)
|
volume, connector)
|
||||||
if device_info:
|
if device_info:
|
||||||
return self.populate_data(device_info, volume, connector)
|
conn_info = self.populate_data(device_info, volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@ -268,7 +269,6 @@ class VMAXFCDriver(san.SanDriver, driver.FibreChannelDriver):
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Disallow connection from connector.
|
"""Disallow connection from connector.
|
||||||
|
|
||||||
@ -290,6 +290,7 @@ class VMAXFCDriver(san.SanDriver, driver.FibreChannelDriver):
|
|||||||
if zoning_mappings:
|
if zoning_mappings:
|
||||||
self.common.terminate_connection(volume, connector)
|
self.common.terminate_connection(volume, connector)
|
||||||
data = self._cleanup_zones(zoning_mappings)
|
data = self._cleanup_zones(zoning_mappings)
|
||||||
|
fczm_utils.remove_fc_zone(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _get_zoning_mappings(self, volume, connector):
|
def _get_zoning_mappings(self, volume, connector):
|
||||||
|
@ -165,7 +165,6 @@ class VNXDriver(driver.ManageableVD,
|
|||||||
"""Make sure volume is exported."""
|
"""Make sure volume is exported."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@zm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Initializes the connection and returns connection info.
|
"""Initializes the connection and returns connection info.
|
||||||
|
|
||||||
@ -219,9 +218,9 @@ class VNXDriver(driver.ManageableVD,
|
|||||||
LOG.debug("Exit initialize_connection"
|
LOG.debug("Exit initialize_connection"
|
||||||
" - Returning connection info: %(conn_info)s.",
|
" - Returning connection info: %(conn_info)s.",
|
||||||
{'conn_info': conn_info})
|
{'conn_info': conn_info})
|
||||||
|
zm_utils.add_fc_zone(conn_info)
|
||||||
return conn_info
|
return conn_info
|
||||||
|
|
||||||
@zm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Disallow connection from connector."""
|
"""Disallow connection from connector."""
|
||||||
LOG.debug("Entering terminate_connection"
|
LOG.debug("Entering terminate_connection"
|
||||||
@ -231,6 +230,7 @@ class VNXDriver(driver.ManageableVD,
|
|||||||
LOG.debug("Exit terminate_connection"
|
LOG.debug("Exit terminate_connection"
|
||||||
" - Returning connection info: %(conn_info)s.",
|
" - Returning connection info: %(conn_info)s.",
|
||||||
{'conn_info': conn_info})
|
{'conn_info': conn_info})
|
||||||
|
zm_utils.remove_fc_zone(conn_info)
|
||||||
return conn_info
|
return conn_info
|
||||||
|
|
||||||
def get_volume_stats(self, refresh=False):
|
def get_volume_stats(self, refresh=False):
|
||||||
|
@ -1206,7 +1206,6 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
|
|||||||
seq = range(len(uniq_luns) + 1)
|
seq = range(len(uniq_luns) + 1)
|
||||||
return min(set(seq) - uniq_luns)
|
return min(set(seq) - uniq_luns)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
wwpns = self._get_initiator_names(connector)
|
wwpns = self._get_initiator_names(connector)
|
||||||
ig_name = self._get_ig_name(connector)
|
ig_name = self._get_ig_name(connector)
|
||||||
@ -1240,14 +1239,15 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
|
|||||||
for ig in igs:
|
for ig in igs:
|
||||||
lunmap = self.create_lun_map(volume, ig, lun_num)
|
lunmap = self.create_lun_map(volume, ig, lun_num)
|
||||||
lun_num = lunmap['lun']
|
lun_num = lunmap['lun']
|
||||||
return {'driver_volume_type': 'fibre_channel',
|
conn_info = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': {
|
'data': {
|
||||||
'target_discovered': False,
|
'target_discovered': False,
|
||||||
'target_lun': lun_num,
|
'target_lun': lun_num,
|
||||||
'target_wwn': self.get_targets(),
|
'target_wwn': self.get_targets(),
|
||||||
'initiator_target_map': i_t_map}}
|
'initiator_target_map': i_t_map}}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
(super(XtremIOFCDriver, self)
|
(super(XtremIOFCDriver, self)
|
||||||
.terminate_connection(volume, connector, **kwargs))
|
.terminate_connection(volume, connector, **kwargs))
|
||||||
@ -1264,8 +1264,10 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
|
|||||||
data = {'target_wwn': self.get_targets(),
|
data = {'target_wwn': self.get_targets(),
|
||||||
'initiator_target_map': i_t_map}
|
'initiator_target_map': i_t_map}
|
||||||
|
|
||||||
return {'driver_volume_type': 'fibre_channel',
|
conn_info = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': data}
|
'data': data}
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def _get_initiator_names(self, connector):
|
def _get_initiator_names(self, connector):
|
||||||
return [wwpn if ':' in wwpn else
|
return [wwpn if ':' in wwpn else
|
||||||
|
@ -83,7 +83,6 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
|
|||||||
def delete_volume(self, volume):
|
def delete_volume(self, volume):
|
||||||
self.common.delete_volume(volume)
|
self.common.delete_volume(volume)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
self.common.client_login()
|
self.common.client_login()
|
||||||
try:
|
try:
|
||||||
@ -98,11 +97,11 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
|
|||||||
data['initiator_target_map'] = init_targ_map
|
data['initiator_target_map'] = init_targ_map
|
||||||
info = {'driver_volume_type': 'fibre_channel',
|
info = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': data}
|
'data': data}
|
||||||
|
fczm_utils.add_fc_zone(info)
|
||||||
return info
|
return info
|
||||||
finally:
|
finally:
|
||||||
self.common.client_logout()
|
self.common.client_logout()
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
info = {'driver_volume_type': 'fibre_channel', 'data': {}}
|
info = {'driver_volume_type': 'fibre_channel', 'data': {}}
|
||||||
try:
|
try:
|
||||||
@ -112,6 +111,7 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
|
|||||||
ports, init_targ_map = self.get_init_targ_map(connector)
|
ports, init_targ_map = self.get_init_targ_map(connector)
|
||||||
info['data'] = {'target_wwn': ports,
|
info['data'] = {'target_wwn': ports,
|
||||||
'initiator_target_map': init_targ_map}
|
'initiator_target_map': init_targ_map}
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
finally:
|
finally:
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ class FJDXFCDriver(driver.FibreChannelDriver):
|
|||||||
"""Driver entry point to remove an export for a volume."""
|
"""Driver entry point to remove an export for a volume."""
|
||||||
return
|
return
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Allow connection to connector and return connection info."""
|
"""Allow connection to connector and return connection info."""
|
||||||
LOG.debug('initialize_connection, volume id: %(vid)s, '
|
LOG.debug('initialize_connection, volume id: %(vid)s, '
|
||||||
@ -163,9 +162,9 @@ class FJDXFCDriver(driver.FibreChannelDriver):
|
|||||||
info['data'] = data
|
info['data'] = data
|
||||||
LOG.debug('initialize_connection, '
|
LOG.debug('initialize_connection, '
|
||||||
'info: %s, exit method.', info)
|
'info: %s, exit method.', info)
|
||||||
|
fczm_utils.add_fc_zone(info)
|
||||||
return info
|
return info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Disallow connection from connector."""
|
"""Disallow connection from connector."""
|
||||||
wwpns = connector.get('wwpns') if connector else None
|
wwpns = connector.get('wwpns') if connector else None
|
||||||
@ -185,6 +184,7 @@ class FJDXFCDriver(driver.FibreChannelDriver):
|
|||||||
# No more volumes attached to the host
|
# No more volumes attached to the host
|
||||||
init_tgt_map = self.common.build_fc_init_tgt_map(connector)
|
init_tgt_map = self.common.build_fc_init_tgt_map(connector)
|
||||||
info['data'] = {'initiator_target_map': init_tgt_map}
|
info['data'] = {'initiator_target_map': init_tgt_map}
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
|
|
||||||
LOG.debug('terminate_connection, unmap: %(unmap)s, '
|
LOG.debug('terminate_connection, unmap: %(unmap)s, '
|
||||||
'connection info: %(info)s, exit method',
|
'connection info: %(info)s, exit method',
|
||||||
|
@ -123,7 +123,6 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
|
|||||||
self.protocol = 'FC'
|
self.protocol = 'FC'
|
||||||
|
|
||||||
@utils.trace
|
@utils.trace
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Assigns the volume to a server.
|
"""Assigns the volume to a server.
|
||||||
|
|
||||||
@ -200,12 +199,12 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
|
|||||||
|
|
||||||
encryption_key_id = volume.get('encryption_key_id', None)
|
encryption_key_id = volume.get('encryption_key_id', None)
|
||||||
info['data']['encrypted'] = encryption_key_id is not None
|
info['data']['encrypted'] = encryption_key_id is not None
|
||||||
|
fczm_utils.add_fc_zone(info)
|
||||||
return info
|
return info
|
||||||
finally:
|
finally:
|
||||||
self._logout(common)
|
self._logout(common)
|
||||||
|
|
||||||
@utils.trace
|
@utils.trace
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Driver entry point to unattach a volume from an instance."""
|
"""Driver entry point to unattach a volume from an instance."""
|
||||||
common = self._login()
|
common = self._login()
|
||||||
@ -247,7 +246,7 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
|
|||||||
|
|
||||||
info['data'] = {'target_wwn': target_wwns,
|
info['data'] = {'target_wwn': target_wwns,
|
||||||
'initiator_target_map': init_targ_map}
|
'initiator_target_map': init_targ_map}
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
return info
|
return info
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -2113,7 +2113,6 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
|
|||||||
data['vendor_name'] = 'Huawei'
|
data['vendor_name'] = 'Huawei'
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@coordination.synchronized('huawei-mapping-{connector[host]}')
|
@coordination.synchronized('huawei-mapping-{connector[host]}')
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
lun_id, lun_type = self.get_lun_id_and_type(volume)
|
lun_id, lun_type = self.get_lun_id_and_type(volume)
|
||||||
@ -2232,6 +2231,7 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
|
|||||||
fc_info['data']['target_lun'] = same_host_id
|
fc_info['data']['target_lun'] = same_host_id
|
||||||
hyperm.rmt_client.logout()
|
hyperm.rmt_client.logout()
|
||||||
|
|
||||||
|
fczm_utils.add_fc_zone(fc_info)
|
||||||
LOG.info("Return FC info is: %s.", fc_info)
|
LOG.info("Return FC info is: %s.", fc_info)
|
||||||
return fc_info
|
return fc_info
|
||||||
|
|
||||||
@ -2256,7 +2256,6 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
|
|||||||
|
|
||||||
return same_host_id
|
return same_host_id
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
@coordination.synchronized('huawei-mapping-{connector[host]}')
|
@coordination.synchronized('huawei-mapping-{connector[host]}')
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Delete map between a volume and a host."""
|
"""Delete map between a volume and a host."""
|
||||||
@ -2346,6 +2345,9 @@ class HuaweiFCDriver(HuaweiBaseDriver, driver.FibreChannelDriver):
|
|||||||
LOG.info("terminate_connection, return data is: %s.",
|
LOG.info("terminate_connection, return data is: %s.",
|
||||||
fc_info)
|
fc_info)
|
||||||
|
|
||||||
|
# This only does something if and only if the initiator_target_map
|
||||||
|
# exists in fc_info
|
||||||
|
fczm_utils.remove_fc_zone(fc_info)
|
||||||
return fc_info
|
return fc_info
|
||||||
|
|
||||||
def _delete_zone_and_remove_fc_initiators(self, wwns, host_id):
|
def _delete_zone_and_remove_fc_initiators(self, wwns, host_id):
|
||||||
|
@ -259,7 +259,6 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
|
|||||||
|
|
||||||
return {'driver_volume_type': type_str, 'data': properties}
|
return {'driver_volume_type': type_str, 'data': properties}
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@utils.synchronized('flashsystem-init-conn', external=True)
|
@utils.synchronized('flashsystem-init-conn', external=True)
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Perform work so that an FC connection can be made.
|
"""Perform work so that an FC connection can be made.
|
||||||
@ -316,9 +315,9 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
|
|||||||
'conn': connector,
|
'conn': connector,
|
||||||
'prop': properties})
|
'prop': properties})
|
||||||
|
|
||||||
|
fczm_utils.add_fc_zone(properties)
|
||||||
return properties
|
return properties
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
@utils.synchronized('flashsystem-term-conn', external=True)
|
@utils.synchronized('flashsystem-term-conn', external=True)
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Cleanup after connection has been terminated.
|
"""Cleanup after connection has been terminated.
|
||||||
@ -353,6 +352,7 @@ class FlashSystemFCDriver(fscommon.FlashSystemDriver):
|
|||||||
self._build_initiator_target_map(
|
self._build_initiator_target_map(
|
||||||
connector['wwpns'], conn_wwpns))
|
connector['wwpns'], conn_wwpns))
|
||||||
return_data['data'] = properties
|
return_data['data'] = properties
|
||||||
|
fczm_utils.remove_fc_zone(return_data)
|
||||||
|
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
'leave: terminate_connection: volume %(vol)s with '
|
'leave: terminate_connection: volume %(vol)s with '
|
||||||
|
@ -144,17 +144,19 @@ class IBMStorageDriver(san.SanDriver,
|
|||||||
|
|
||||||
return self.proxy.remove_export(context, volume)
|
return self.proxy.remove_export(context, volume)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Map the created volume."""
|
"""Map the created volume."""
|
||||||
|
|
||||||
return self.proxy.initialize_connection(volume, connector)
|
conn_info = self.proxy.initialize_connection(volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Terminate a connection to a volume."""
|
"""Terminate a connection to a volume."""
|
||||||
|
|
||||||
return self.proxy.terminate_connection(volume, connector)
|
conn_info = self.proxy.terminate_connection(volume, connector)
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def create_volume_from_snapshot(self, volume, snapshot):
|
def create_volume_from_snapshot(self, volume, snapshot):
|
||||||
"""Create a volume from a snapshot."""
|
"""Create a volume from a snapshot."""
|
||||||
|
@ -133,12 +133,13 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
|
|||||||
|
|
||||||
return self.initialize_connection(volume, connector)
|
return self.initialize_connection(volume, connector)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Perform necessary work to make a FC connection."""
|
"""Perform necessary work to make a FC connection."""
|
||||||
@coordination.synchronized('storwize-host-{system_id}-{host}')
|
@coordination.synchronized('storwize-host-{system_id}-{host}')
|
||||||
def _do_initialize_connection_locked(system_id, host):
|
def _do_initialize_connection_locked(system_id, host):
|
||||||
return self._do_initialize_connection(volume, connector)
|
conn_info = self._do_initialize_connection(volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
return _do_initialize_connection_locked(self._state['system_id'],
|
return _do_initialize_connection_locked(self._state['system_id'],
|
||||||
connector['host'])
|
connector['host'])
|
||||||
|
|
||||||
@ -297,7 +298,6 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
|
|||||||
|
|
||||||
return self.terminate_connection(volume, connector, **kwargs)
|
return self.terminate_connection(volume, connector, **kwargs)
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Cleanup after an FC connection has been terminated."""
|
"""Cleanup after an FC connection has been terminated."""
|
||||||
# If a fake connector is generated by nova when the host
|
# If a fake connector is generated by nova when the host
|
||||||
@ -308,8 +308,10 @@ class StorwizeSVCFCDriver(storwize_common.StorwizeSVCCommonDriver):
|
|||||||
|
|
||||||
@coordination.synchronized('storwize-host-{system_id}-{host}')
|
@coordination.synchronized('storwize-host-{system_id}-{host}')
|
||||||
def _do_terminate_connection_locked(system_id, host):
|
def _do_terminate_connection_locked(system_id, host):
|
||||||
return self._do_terminate_connection(volume, connector,
|
conn_info = self._do_terminate_connection(volume, connector,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
return _do_terminate_connection_locked(self._state['system_id'], host)
|
return _do_terminate_connection_locked(self._state['system_id'], host)
|
||||||
|
|
||||||
def _do_terminate_connection(self, volume, connector, **kwargs):
|
def _do_terminate_connection(self, volume, connector, **kwargs):
|
||||||
|
@ -330,11 +330,13 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
|
|||||||
target_wwpns = list(self._get_online_fc_ports())
|
target_wwpns = list(self._get_online_fc_ports())
|
||||||
target_wwpns, init_target_map = self._build_initiator_target_map(
|
target_wwpns, init_target_map = self._build_initiator_target_map(
|
||||||
connector, target_wwpns)
|
connector, target_wwpns)
|
||||||
return dict(driver_volume_type='fibre_channel',
|
conn_info = dict(driver_volume_type='fibre_channel',
|
||||||
data=dict(target_discovered=False,
|
data=dict(target_discovered=False,
|
||||||
target_wwn=target_wwpns,
|
target_wwn=target_wwpns,
|
||||||
target_lun=lun,
|
target_lun=lun,
|
||||||
initiator_target_map=init_target_map))
|
initiator_target_map=init_target_map))
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def _get_iscsi_network_space(self, netspace_name):
|
def _get_iscsi_network_space(self, netspace_name):
|
||||||
netspace = self._system.network_spaces.safe_get(
|
netspace = self._system.network_spaces.safe_get(
|
||||||
@ -417,7 +419,6 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
|
|||||||
ports = [iqn.IQN(connector['initiator'])]
|
ports = [iqn.IQN(connector['initiator'])]
|
||||||
return ports
|
return ports
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@infinisdk_to_cinder_exceptions
|
@infinisdk_to_cinder_exceptions
|
||||||
@coordination.synchronized('infinidat-{self.management_address}-lock')
|
@coordination.synchronized('infinidat-{self.management_address}-lock')
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
@ -427,7 +428,6 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
|
|||||||
else:
|
else:
|
||||||
return self._initialize_connection_iscsi(volume, connector)
|
return self._initialize_connection_iscsi(volume, connector)
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
@infinisdk_to_cinder_exceptions
|
@infinisdk_to_cinder_exceptions
|
||||||
@coordination.synchronized('infinidat-{self.management_address}-lock')
|
@coordination.synchronized('infinidat-{self.management_address}-lock')
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
@ -462,8 +462,11 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
|
|||||||
target_wwpns))
|
target_wwpns))
|
||||||
result_data = dict(target_wwn=target_wwpns,
|
result_data = dict(target_wwn=target_wwpns,
|
||||||
initiator_target_map=target_map)
|
initiator_target_map=target_map)
|
||||||
return dict(driver_volume_type=volume_type,
|
conn_info = dict(driver_volume_type=volume_type,
|
||||||
data=result_data)
|
data=result_data)
|
||||||
|
if self._protocol == 'FC':
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@infinisdk_to_cinder_exceptions
|
@infinisdk_to_cinder_exceptions
|
||||||
def get_volume_stats(self, refresh=False):
|
def get_volume_stats(self, refresh=False):
|
||||||
|
@ -58,7 +58,6 @@ class InStorageMCSFCDriver(instorage_common.InStorageMCSCommonDriver,
|
|||||||
self.protocol = 'FC'
|
self.protocol = 'FC'
|
||||||
|
|
||||||
@cinder_utils.trace
|
@cinder_utils.trace
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@coordination.synchronized('instorage-host'
|
@coordination.synchronized('instorage-host'
|
||||||
'{self._state[system_id]}'
|
'{self._state[system_id]}'
|
||||||
'{connector[host]}')
|
'{connector[host]}')
|
||||||
@ -155,9 +154,10 @@ class InStorageMCSFCDriver(instorage_common.InStorageMCSCommonDriver,
|
|||||||
'%(conn)s.\n', {'vol': volume,
|
'%(conn)s.\n', {'vol': volume,
|
||||||
'conn': connector})
|
'conn': connector})
|
||||||
|
|
||||||
return {'driver_volume_type': 'fibre_channel', 'data': properties, }
|
info = {'driver_volume_type': 'fibre_channel', 'data': properties, }
|
||||||
|
fczm_utils.add_fc_zone(info)
|
||||||
|
return info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Cleanup after an FC connection has been terminated."""
|
"""Cleanup after an FC connection has been terminated."""
|
||||||
# If a fake connector is generated by nova when the host
|
# If a fake connector is generated by nova when the host
|
||||||
@ -227,6 +227,8 @@ class InStorageMCSFCDriver(instorage_common.InStorageMCSCommonDriver,
|
|||||||
(connector['wwpns'],
|
(connector['wwpns'],
|
||||||
target_wwpns))
|
target_wwpns))
|
||||||
info['data'] = {'initiator_target_map': init_targ_map}
|
info['data'] = {'initiator_target_map': init_targ_map}
|
||||||
|
# Only remove the zone if it's the last volume removed
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
# No volume mapped to the host, delete host from array
|
# No volume mapped to the host, delete host from array
|
||||||
self._assistant.delete_host(host_name)
|
self._assistant.delete_host(host_name)
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
|
|||||||
self._protocol = 'FC'
|
self._protocol = 'FC'
|
||||||
self.lookup_service = fczm_utils.create_lookup_service()
|
self.lookup_service = fczm_utils.create_lookup_service()
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@utils.trace
|
@utils.trace
|
||||||
@coordination.synchronized('{self.k2_lock_name}')
|
@coordination.synchronized('{self.k2_lock_name}')
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
@ -76,13 +75,14 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
|
|||||||
if temp_client:
|
if temp_client:
|
||||||
self.client = temp_client
|
self.client = temp_client
|
||||||
# Return target volume information.
|
# Return target volume information.
|
||||||
return {'driver_volume_type': 'fibre_channel',
|
conn_info = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': {"target_discovered": True,
|
'data': {"target_discovered": True,
|
||||||
"target_lun": lun,
|
"target_lun": lun,
|
||||||
"target_wwn": target_wwpns,
|
"target_wwn": target_wwpns,
|
||||||
"initiator_target_map": init_target_map}}
|
"initiator_target_map": init_target_map}}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
@utils.trace
|
@utils.trace
|
||||||
@coordination.synchronized('{self.k2_lock_name}')
|
@coordination.synchronized('{self.k2_lock_name}')
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
@ -105,6 +105,8 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
|
|||||||
connector, target_wwpns)
|
connector, target_wwpns)
|
||||||
properties["data"] = {"target_wwn": target_wwpns,
|
properties["data"] = {"target_wwn": target_wwpns,
|
||||||
"initiator_target_map": init_target_map}
|
"initiator_target_map": init_target_map}
|
||||||
|
fczm_utils.remove_fc_zone(properties)
|
||||||
|
|
||||||
# To support replication failback
|
# To support replication failback
|
||||||
if temp_client:
|
if temp_client:
|
||||||
self.client = temp_client
|
self.client = temp_client
|
||||||
|
@ -80,13 +80,15 @@ class MStorageFCDriver(volume_helper.MStorageDSVDriver,
|
|||||||
def get_volume_stats(self, refresh=False):
|
def get_volume_stats(self, refresh=False):
|
||||||
return self.fc_get_volume_stats(refresh)
|
return self.fc_get_volume_stats(refresh)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
return self.fc_initialize_connection(volume, connector)
|
conn_info = self.fc_initialize_connection(volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
return self.fc_terminate_connection(volume, connector)
|
conn_info = self.fc_terminate_connection(volume, connector)
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def create_export_snapshot(self, context, snapshot, connector):
|
def create_export_snapshot(self, context, snapshot, connector):
|
||||||
return self.fc_do_export_snapshot(context, snapshot, connector)
|
return self.fc_do_export_snapshot(context, snapshot, connector)
|
||||||
|
@ -94,14 +94,16 @@ class NetAppCmodeFibreChannelDriver(driver.BaseVD,
|
|||||||
def unmanage(self, volume):
|
def unmanage(self, volume):
|
||||||
return self.library.unmanage(volume)
|
return self.library.unmanage(volume)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
return self.library.initialize_connection_fc(volume, connector)
|
conn_info = self.library.initialize_connection_fc(volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
return self.library.terminate_connection_fc(volume, connector,
|
conn_info = self.library.terminate_connection_fc(volume, connector,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def get_pool(self, volume):
|
def get_pool(self, volume):
|
||||||
return self.library.get_pool(volume)
|
return self.library.get_pool(volume)
|
||||||
|
@ -88,14 +88,16 @@ class NetAppEseriesFibreChannelDriver(driver.BaseVD,
|
|||||||
def unmanage(self, volume):
|
def unmanage(self, volume):
|
||||||
return self.library.unmanage(volume)
|
return self.library.unmanage(volume)
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector, **kwargs):
|
def initialize_connection(self, volume, connector, **kwargs):
|
||||||
return self.library.initialize_connection_fc(volume, connector)
|
conn_info = self.library.initialize_connection_fc(volume, connector)
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
return self.library.terminate_connection_fc(volume, connector,
|
conn_info = self.library.terminate_connection_fc(volume, connector,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
fczm_utils.remove_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
def get_pool(self, volume):
|
def get_pool(self, volume):
|
||||||
return self.library.get_pool(volume)
|
return self.library.get_pool(volume)
|
||||||
|
@ -860,7 +860,6 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
|
|
||||||
return init_targ_map
|
return init_targ_map
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Driver entry point to attach a volume to an instance."""
|
"""Driver entry point to attach a volume to an instance."""
|
||||||
LOG.info('Entering initialize_connection volume=%(vol)s'
|
LOG.info('Entering initialize_connection volume=%(vol)s'
|
||||||
@ -899,10 +898,9 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
|
|
||||||
LOG.info("Return FC data for zone addition: %(data)s.",
|
LOG.info("Return FC data for zone addition: %(data)s.",
|
||||||
{'data': data})
|
{'data': data})
|
||||||
|
fczm_utils.add_fc_zone(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Driver entry point to unattach a volume from an instance."""
|
"""Driver entry point to unattach a volume from an instance."""
|
||||||
LOG.info('Entering terminate_connection volume=%(vol)s'
|
LOG.info('Entering terminate_connection volume=%(vol)s'
|
||||||
@ -934,6 +932,10 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
data = {'driver_volume_type': 'fibre_channel',
|
data = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': {'target_wwn': target_wwns}}
|
'data': {'target_wwn': target_wwns}}
|
||||||
|
|
||||||
|
# FIXME: need to optionally add the initiator_target_map here when
|
||||||
|
# there are no more volumes exported to the initiator / target pair
|
||||||
|
# otherwise the zone will never get removed.
|
||||||
|
fczm_utils.remove_fc_zone(data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_wwpns_from_array(self, array_name):
|
def get_wwpns_from_array(self, array_name):
|
||||||
|
@ -218,7 +218,6 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
|
|||||||
|
|
||||||
return init_targ_map
|
return init_targ_map
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Allow connection to connector and return connection info."""
|
"""Allow connection to connector and return connection info."""
|
||||||
"""
|
"""
|
||||||
@ -336,10 +335,11 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
|
|||||||
LOG.info('Connect initialization info: '
|
LOG.info('Connect initialization info: '
|
||||||
'{driver_volume_type: fibre_channel, '
|
'{driver_volume_type: fibre_channel, '
|
||||||
'data: %(properties)s', {'properties': properties})
|
'data: %(properties)s', {'properties': properties})
|
||||||
return {'driver_volume_type': 'fibre_channel',
|
conn_info = {'driver_volume_type': 'fibre_channel',
|
||||||
'data': properties}
|
'data': properties}
|
||||||
|
fczm_utils.add_fc_zone(conn_info)
|
||||||
|
return conn_info
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Disallow connection from connector."""
|
"""Disallow connection from connector."""
|
||||||
"""
|
"""
|
||||||
@ -397,6 +397,7 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
|
|||||||
lsTargets)
|
lsTargets)
|
||||||
info['data'] = {'target_wwn': lsTargets,
|
info['data'] = {'target_wwn': lsTargets,
|
||||||
'initiator_target_map': init_targ_map}
|
'initiator_target_map': init_targ_map}
|
||||||
|
fczm_utils.remove_fc_zone(info)
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
@ -1932,7 +1932,6 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
ports = array.list_ports()
|
ports = array.list_ports()
|
||||||
return [port["wwn"] for port in ports if port["wwn"]]
|
return [port["wwn"] for port in ports if port["wwn"]]
|
||||||
|
|
||||||
@fczm_utils.add_fc_zone
|
|
||||||
@pure_driver_debug_trace
|
@pure_driver_debug_trace
|
||||||
def initialize_connection(self, volume, connector):
|
def initialize_connection(self, volume, connector):
|
||||||
"""Allow connection to connector and return connection info."""
|
"""Allow connection to connector and return connection info."""
|
||||||
@ -1952,6 +1951,7 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fczm_utils.add_fc_zone(properties)
|
||||||
return properties
|
return properties
|
||||||
|
|
||||||
@utils.retry(exception.PureRetryableException,
|
@utils.retry(exception.PureRetryableException,
|
||||||
@ -2009,7 +2009,6 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
|
|
||||||
return init_targ_map
|
return init_targ_map
|
||||||
|
|
||||||
@fczm_utils.remove_fc_zone
|
|
||||||
@pure_driver_debug_trace
|
@pure_driver_debug_trace
|
||||||
def terminate_connection(self, volume, connector, **kwargs):
|
def terminate_connection(self, volume, connector, **kwargs):
|
||||||
"""Terminate connection."""
|
"""Terminate connection."""
|
||||||
@ -2027,4 +2026,5 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
|
|||||||
properties["data"] = {"target_wwn": target_wwns,
|
properties["data"] = {"target_wwn": target_wwns,
|
||||||
"initiator_target_map": init_targ_map}
|
"initiator_target_map": init_targ_map}
|
||||||
|
|
||||||
|
fczm_utils.remove_fc_zone(properties)
|
||||||
return properties
|
return properties
|
||||||
|
@ -73,49 +73,27 @@ def get_formatted_wwn(wwn_str):
|
|||||||
for i in range(0, len(wwn_str), 2)])).lower()
|
for i in range(0, len(wwn_str), 2)])).lower()
|
||||||
|
|
||||||
|
|
||||||
def add_fc_zone(initialize_connection):
|
def add_fc_zone(connection_info):
|
||||||
"""Decorator to add a FC Zone."""
|
"""Utility function to add a FC Zone."""
|
||||||
|
if connection_info:
|
||||||
def decorator(self, *args, **kwargs):
|
vol_type = connection_info.get('driver_volume_type', None)
|
||||||
conn_info = initialize_connection(self, *args, **kwargs)
|
|
||||||
if not conn_info:
|
|
||||||
LOG.warning("Driver didn't return connection info, "
|
|
||||||
"can't add zone.")
|
|
||||||
return None
|
|
||||||
|
|
||||||
vol_type = conn_info.get('driver_volume_type', None)
|
|
||||||
if vol_type == 'fibre_channel':
|
if vol_type == 'fibre_channel':
|
||||||
if 'initiator_target_map' in conn_info['data']:
|
if 'initiator_target_map' in connection_info['data']:
|
||||||
zm = create_zone_manager()
|
zm = create_zone_manager()
|
||||||
if zm:
|
if zm:
|
||||||
LOG.debug("add_fc_zone connection info: %(conninfo)s.",
|
LOG.debug("add_fc_zone connection info: %(conninfo)s.",
|
||||||
{'conninfo': conn_info})
|
{'conninfo': connection_info})
|
||||||
zm.add_connection(conn_info)
|
zm.add_connection(connection_info)
|
||||||
|
|
||||||
return conn_info
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
|
|
||||||
def remove_fc_zone(terminate_connection):
|
def remove_fc_zone(connection_info):
|
||||||
"""Decorator for FC drivers to remove zone."""
|
"""Utility function for FC drivers to remove zone."""
|
||||||
|
if connection_info:
|
||||||
def decorator(self, *args, **kwargs):
|
vol_type = connection_info.get('driver_volume_type', None)
|
||||||
conn_info = terminate_connection(self, *args, **kwargs)
|
|
||||||
if not conn_info:
|
|
||||||
LOG.warning("Driver didn't return connection info from "
|
|
||||||
"terminate_connection call.")
|
|
||||||
return None
|
|
||||||
|
|
||||||
vol_type = conn_info.get('driver_volume_type', None)
|
|
||||||
if vol_type == 'fibre_channel':
|
if vol_type == 'fibre_channel':
|
||||||
if 'initiator_target_map' in conn_info['data']:
|
if 'initiator_target_map' in connection_info['data']:
|
||||||
zm = create_zone_manager()
|
zm = create_zone_manager()
|
||||||
if zm:
|
if zm:
|
||||||
LOG.debug("remove_fc_zone connection info: %(conninfo)s.",
|
LOG.debug("remove_fc_zone connection info: %(conninfo)s.",
|
||||||
{'conninfo': conn_info})
|
{'conninfo': connection_info})
|
||||||
zm.delete_connection(conn_info)
|
zm.delete_connection(connection_info)
|
||||||
|
|
||||||
return conn_info
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
Loading…
Reference in New Issue
Block a user