Merge "FC: Ignore some HBAs from map for single WWNN"
This commit is contained in:
commit
0afbf125b3
|
@ -89,13 +89,13 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
|
||||||
if ports:
|
if ports:
|
||||||
hbas = [hba for hba in hbas if hba['port_name'] in ports]
|
hbas = [hba for hba in hbas if hba['port_name'] in ports]
|
||||||
LOG.debug('Using initiator target map to exclude HBAs')
|
LOG.debug('Using initiator target map to exclude HBAs')
|
||||||
process = [(hba, get_ctsl(hba, connection_properties))
|
|
||||||
for hba in hbas]
|
|
||||||
|
|
||||||
# With no target map we'll check if target implements single WWNN for
|
# Check if target implements single WWNN for all ports, if it does we
|
||||||
# all ports, if it does we only use HBAs connected (info was found),
|
# only use HBAs connected (info was found), otherwise we are forced to
|
||||||
# otherwise we are forced to blindly scan all HBAs.
|
# blindly scan all HBAs. We also do this when we have
|
||||||
else:
|
# initiator_target_map, because some drivers return all HBAs but they
|
||||||
|
# implement single WWNN and we avoid adding unrelated LUNs this way
|
||||||
|
# (LP bug#1765000).
|
||||||
with_info = []
|
with_info = []
|
||||||
no_info = []
|
no_info = []
|
||||||
|
|
||||||
|
|
|
@ -295,6 +295,33 @@ class LinuxFCTestCase(base.TestCase):
|
||||||
mock.call(hbas[1], con_props)]
|
mock.call(hbas[1], con_props)]
|
||||||
mock_get_chan.assert_has_calls(expected_calls)
|
mock_get_chan.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
|
def test_rescan_hosts_initiator_map_single_wwnn(self):
|
||||||
|
"""Test FC rescan with initiator map and single WWNN."""
|
||||||
|
get_chan_results = [[['2', '3', 1], ['4', '5', 1]], [['-', '-', 1]]]
|
||||||
|
|
||||||
|
hbas, con_props = self.__get_rescan_info(zone_manager=True)
|
||||||
|
|
||||||
|
with mock.patch.object(self.lfc, '_execute',
|
||||||
|
return_value=None) as execute_mock, \
|
||||||
|
mock.patch.object(self.lfc, '_get_hba_channel_scsi_target',
|
||||||
|
side_effect=get_chan_results) as mock_get_chan:
|
||||||
|
|
||||||
|
self.lfc.rescan_hosts(hbas, con_props)
|
||||||
|
expected_commands = [
|
||||||
|
mock.call('tee', '-a', '/sys/class/scsi_host/host6/scan',
|
||||||
|
process_input='2 3 1',
|
||||||
|
root_helper=None, run_as_root=True),
|
||||||
|
mock.call('tee', '-a', '/sys/class/scsi_host/host6/scan',
|
||||||
|
process_input='4 5 1',
|
||||||
|
root_helper=None, run_as_root=True)]
|
||||||
|
|
||||||
|
execute_mock.assert_has_calls(expected_commands)
|
||||||
|
self.assertEqual(len(expected_commands), execute_mock.call_count)
|
||||||
|
|
||||||
|
expected_calls = [mock.call(hbas[0], con_props),
|
||||||
|
mock.call(hbas[1], con_props)]
|
||||||
|
mock_get_chan.assert_has_calls(expected_calls)
|
||||||
|
|
||||||
def test_rescan_hosts_wildcard(self):
|
def test_rescan_hosts_wildcard(self):
|
||||||
"""Test when we don't have initiator map or target is single WWNN."""
|
"""Test when we don't have initiator map or target is single WWNN."""
|
||||||
get_chan_results = [[['-', '-', 1]], [['-', '-', 1]]]
|
get_chan_results = [[['-', '-', 1]], [['-', '-', 1]]]
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Always check if we are dealing with a single WWNN Fibre Channel target,
|
||||||
|
even when we receive an initiator_target_map.
|
||||||
|
This allows us to exclude unconnected HBAs from our scan for storage arrays
|
||||||
|
that automatically connect all target ports (due to their architecture and
|
||||||
|
design) even if the Cinder driver returns the initiator_target_map,
|
||||||
|
provided the target has a single WWNN.
|
||||||
|
Excluding these HBAs prevents undesired volumes from being connected.
|
Loading…
Reference in New Issue