Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-133834 / 25.04-RC.1 / Ensure we populate node_name and parent_host for NPIV (by bmeagherix) #15496

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/middlewared/middlewared/etc_files/scst.conf.mako
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@
if user and secret:
discovery_outgoing.append(f'{user} {secret}')

def ha_node_wwpn_for_fcport(fcport):
# Populate this below
fc_host_by_port_name = {}

def ha_node_wwpn_for_fcport_or_fchost(fcport):
if render_ctx['failover.node'] == 'A':
return wwn_as_colon_hex(fcport['wwpn'])
elif render_ctx['failover.node'] == 'B':
Expand Down Expand Up @@ -99,7 +102,9 @@
if '/' in fcport['port']:
parent_port_name = fcport['port'].split('/')[0]
if parent_fcport := fcports_by_port_name.get(parent_port_name):
return ha_node_wwpn_for_fcport(parent_fcport)
return ha_node_wwpn_for_fcport_or_fchost(parent_fcport)
if parent_fchost := fc_host_by_port_name.get(parent_port_name):
return ha_node_wwpn_for_fcport_or_fchost(parent_fchost)

def fc_initiator_access_for_target(target):
initiator_access = set()
Expand All @@ -111,6 +116,7 @@
return initiator_access

if render_ctx['fc.capable']:
fc_host_by_port_name = {x['alias']: x for x in middleware.call_sync('fc.fc_host.query')}
# Physical devices are added to the config automatically. We want to
# identify any that are not being used and select a rel_tgt_id in the
# 10K range for them.
Expand Down Expand Up @@ -624,7 +630,7 @@ TARGET_DRIVER qla2x00t {
% if alua_enabled:
## ALUA enabled - write out the target for this node
<%
wwpn = ha_node_wwpn_for_fcport(fcport)
wwpn = ha_node_wwpn_for_fcport_or_fchost(fcport)
target = fcport_to_target(fcport)
fc_initiator_access = fc_initiator_access_for_target(target)
parent_host = fcport_to_parent_host(fcport)
Expand Down Expand Up @@ -684,7 +690,7 @@ TARGET_DRIVER qla2x00t {
## ALUA not enabled - only write out the target for this node if MASTER
% if failover_status == "MASTER":
<%
wwpn = ha_node_wwpn_for_fcport(fcport)
wwpn = ha_node_wwpn_for_fcport_or_fchost(fcport)
target = fcport_to_target(fcport)
fc_initiator_access = fc_initiator_access_for_target(target)
parent_host = fcport_to_parent_host(fcport)
Expand Down
Loading