os-brick/os_brick/tests/initiator
Rajat Dhasmana f2154eedf0 Fix: FC partial target scan
When fetching the target value (T in HCTL) for the storage HBAs,
we use the /sys/class/fc_transport path to find available targets.
However, this path only contains targets that already have a LUN
attached from, to the host.

Scenario:
If we have 2 controllers on the backend side with 4 target HBAs each (total 8).
For the first LUN mapping from controller1, we will do a wildcard
scan and find the 4 targets from controller1 which will get
populated in the /fc_transport path.
If we try mapping a LUN from controller2, we try to find targets in the
fc_transport path but the path only contains targets from controller1 so
we will not be able to discover the LUN from controller2 and fail with
NoFibreChannelVolumeDeviceFound exception.

Solution:
In each rescan attempt, we will first search for targets in the
fc_transport path: "/sys/class/fc_transport/target<host>*".
If the target in not found then we will search in the fc_remote_ports
path: "/sys/class/fc_remote_ports/rport-<host>*"

If a [c,t,l] combination is found from either path, we add it to
the list of ctls we later use it for scanning.

This way, we don't alter the current "working" mechanism of scanning
but also add an additional way of discovering targets and improving
the scan to avoid failure scenarios in each rescan attempt.

Closes-Bug: #2051237
Change-Id: Ia74b0fc24e0cf92453e65d15b4a76e565ed04d16
2024-02-13 20:16:22 +05:30
..
connectors Merge "NVMe-oF: Support nvme cli v2" 2024-01-10 14:12:09 +00:00
__init__.py renamed the project to os-brick 2015-02-05 23:58:37 +00:00
test_connector.py Fix unit tests when hostid file exists 2023-08-24 15:28:35 +00:00
test_host_driver.py Use unittest.mock instead of third party mock 2020-04-18 16:22:50 -05:00
test_linuxfc.py Fix: FC partial target scan 2024-02-13 20:16:22 +05:30
test_linuxrbd.py RBD: Improve close and flush in IOWrapper 2023-08-23 12:33:37 +02:00
test_linuxscsi.py Check paths before extending device 2023-08-24 11:40:32 +00:00
test_utils.py Support shared_targets tristate value 2022-07-26 16:28:36 +02:00