Skip to content

Commit

Permalink
NAS-133885 / 25.10 / More Fibre Channel NPIV fixes (#15527)
Browse files Browse the repository at this point in the history
* Fix tests to include node_name and parent_host for NPIV targets

* Ensure we populate node_name and parent_host for NPIV on non-HA
  • Loading branch information
bmeagherix authored Jan 30, 2025
1 parent c8ee757 commit 8b73f01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/middlewared/middlewared/etc_files/scst.conf.mako
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
fc_host_by_port_name = {}
def ha_node_wwpn_for_fcport_or_fchost(fcport):
if render_ctx['failover.node'] == 'A':
if not is_ha or render_ctx['failover.node'] == 'A':
return wwn_as_colon_hex(fcport['wwpn'])
elif render_ctx['failover.node'] == 'B':
return wwn_as_colon_hex(fcport['wwpn_b'])
def ha_node_wwpn_for_target(target, node):
if target['id'] in fcports_by_target_id:
fcport = fcports_by_target_id[target['id']]
if node == 'A':
if not is_ha or node == 'A':
return wwn_as_colon_hex(fcport['wwpn'])
elif node == 'B':
return wwn_as_colon_hex(fcport['wwpn_b'])
Expand Down Expand Up @@ -730,9 +730,14 @@ TARGET_DRIVER qla2x00t {
<%
wwpn = wwn_as_colon_hex(fcport['wwpn'])
target = fcport_to_target(fcport)
parent_host = fcport_to_parent_host(fcport)
%>
% if wwpn and target:
TARGET ${wwpn} {
% if parent_host:
node_name ${parent_host}
parent_host ${parent_host}
% endif ## parent_host
rel_tgt_id ${target['rel_tgt_id'] + REL_TGT_ID_FC_OFFSET}
enabled 1
% for associated_target in associated_targets[fcport['target']['id']]:
Expand Down
2 changes: 2 additions & 0 deletions tests/api2/test_fibre_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ def test_npiv_setting(self, fc_hosts):
assert scst_qla_targets[key2] == {
'LUN': {'0': 'fcextent1'},
'enabled': '1',
'node_name': key0,
'parent_host': key0,
'rel_tgt_id': str(5001 + rel_tgt_id_node_offset)
}

Expand Down

0 comments on commit 8b73f01

Please sign in to comment.