Merge "FC improve logging"
This commit is contained in:
@@ -72,6 +72,8 @@ class FibreChannelConnector(base.BaseLinuxConnector):
|
|||||||
return '/dev/disk/by-path'
|
return '/dev/disk/by-path'
|
||||||
|
|
||||||
def _add_targets_to_connection_properties(self, connection_properties):
|
def _add_targets_to_connection_properties(self, connection_properties):
|
||||||
|
LOG.debug('Adding targets to connection properties receives: %s',
|
||||||
|
connection_properties)
|
||||||
target_wwn = connection_properties.get('target_wwn')
|
target_wwn = connection_properties.get('target_wwn')
|
||||||
target_wwns = connection_properties.get('target_wwns')
|
target_wwns = connection_properties.get('target_wwns')
|
||||||
if target_wwns:
|
if target_wwns:
|
||||||
@@ -105,9 +107,7 @@ class FibreChannelConnector(base.BaseLinuxConnector):
|
|||||||
targets = list(zip(wwns, luns))
|
targets = list(zip(wwns, luns))
|
||||||
elif len(luns) == 1 and len(wwns) > 1:
|
elif len(luns) == 1 and len(wwns) > 1:
|
||||||
# For the case of multiple wwns, but a single lun (old path)
|
# For the case of multiple wwns, but a single lun (old path)
|
||||||
targets = []
|
targets = [(wwn, luns[0]) for wwn in wwns]
|
||||||
for wwn in wwns:
|
|
||||||
targets.append((wwn, luns[0]))
|
|
||||||
else:
|
else:
|
||||||
# Something is wrong, this shouldn't happen.
|
# Something is wrong, this shouldn't happen.
|
||||||
msg = _("Unable to find potential volume paths for FC device "
|
msg = _("Unable to find potential volume paths for FC device "
|
||||||
@@ -117,12 +117,10 @@ class FibreChannelConnector(base.BaseLinuxConnector):
|
|||||||
raise exception.VolumePathsNotFound(msg)
|
raise exception.VolumePathsNotFound(msg)
|
||||||
|
|
||||||
connection_properties['targets'] = targets
|
connection_properties['targets'] = targets
|
||||||
|
wwpn_lun_map = {wwpn: lun for wwpn, lun in targets}
|
||||||
|
|
||||||
wwpn_lun_map = dict()
|
# If there is an initiator_target_map we can update it too and generate
|
||||||
for wwpn, lun in targets:
|
# the initiator_target_lun_map from it
|
||||||
wwpn_lun_map[wwpn] = lun
|
|
||||||
|
|
||||||
# If there is an initiator_target_map we can update it too
|
|
||||||
if connection_properties.get('initiator_target_map') is not None:
|
if connection_properties.get('initiator_target_map') is not None:
|
||||||
# Convert it to lower case
|
# Convert it to lower case
|
||||||
itmap = connection_properties['initiator_target_map']
|
itmap = connection_properties['initiator_target_map']
|
||||||
@@ -130,17 +128,24 @@ class FibreChannelConnector(base.BaseLinuxConnector):
|
|||||||
for k, v in itmap.items()}
|
for k, v in itmap.items()}
|
||||||
connection_properties['initiator_target_map'] = itmap
|
connection_properties['initiator_target_map'] = itmap
|
||||||
|
|
||||||
new_itmap = dict()
|
itmaplun = dict()
|
||||||
for init_wwpn in itmap:
|
for init_wwpn, target_wwpns in itmap.items():
|
||||||
target_wwpns = itmap[init_wwpn]
|
itmaplun[init_wwpn] = [(target_wwpn, wwpn_lun_map[target_wwpn])
|
||||||
init_targets = []
|
for target_wwpn in target_wwpns
|
||||||
for target_wwpn in target_wwpns:
|
if target_wwpn in wwpn_lun_map]
|
||||||
if target_wwpn in wwpn_lun_map:
|
|
||||||
init_targets.append((target_wwpn,
|
|
||||||
wwpn_lun_map[target_wwpn]))
|
|
||||||
new_itmap[init_wwpn] = init_targets
|
|
||||||
connection_properties['initiator_target_lun_map'] = new_itmap
|
|
||||||
|
|
||||||
|
# We added the if in the previous list comprehension in case
|
||||||
|
# drivers return targets in the map that are not reported in
|
||||||
|
# target_wwn or target_wwns, but we warn about it.
|
||||||
|
if len(itmaplun[init_wwpn]) != len(itmap[init_wwpn]):
|
||||||
|
unknown = set(itmap[init_wwpn])
|
||||||
|
unknown.difference_update(itmaplun[init_wwpn])
|
||||||
|
LOG.warning('Driver returned an unknown targets in the '
|
||||||
|
'initiator mapping %s', ', '.join(unknown))
|
||||||
|
connection_properties['initiator_target_lun_map'] = itmaplun
|
||||||
|
|
||||||
|
LOG.debug('Adding targets to connection properties returns: %s',
|
||||||
|
connection_properties)
|
||||||
return connection_properties
|
return connection_properties
|
||||||
|
|
||||||
def _get_possible_volume_paths(self, connection_properties, hbas):
|
def _get_possible_volume_paths(self, connection_properties, hbas):
|
||||||
|
|||||||
Reference in New Issue
Block a user