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

nvmf / IPv6 related fixes for SLE15-SP5 #254

Merged
merged 7 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion modules.d/35network-legacy/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ depends() {

# called by dracut
installkernel() {
return 0
# arping depends on af_packet
hostonly='' instmods af_packet
}

# called by dracut
Expand Down
7 changes: 3 additions & 4 deletions modules.d/40network/net-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ ibft_to_cmdline() {
[ -e "${iface}"/hostname ] && read -r hostname < "${iface}"/hostname
if [ "$family" = "ipv6" ]; then
if [ -n "$ip" ]; then
[ -n "$prefix" ] || prefix=64
ip="[${ip}/${prefix}]"
mask=
[ -n "$prefix" ] || prefix=128
ip="[${ip}]"
mask=$prefix
fi
if [ -n "$gw" ]; then
gw="[${gw}]"
Expand Down Expand Up @@ -725,7 +725,6 @@ wait_for_ipv6_dad() {
while [ $cnt -lt $timeout ]; do
[ -n "$(ip -6 addr show dev "$@")" ] \
&& [ -z "$(ip -6 addr show dev "$@" tentative)" ] \
&& { ip -6 route list proto ra dev "$@" | grep -q ^default; } \
&& return 0
[ -n "$(ip -6 addr show dev "$@" dadfailed)" ] \
&& return 1
Expand Down
34 changes: 31 additions & 3 deletions modules.d/95nvmf/nvmf-autoconnect.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
#!/bin/bash
#!/bin/sh
# Argument $1 is "settled", "online", or "timeout", indicating
# the queue from which the script is called.
# In the "timeout" case, try everything.
# Otherwise, try options according to the priorities below.

[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1
echo add > /sys/class/fc/fc_udev_device/nvme_discovery
[ "$RD_DEBUG" != yes ] || set -x

NVMF_HOSTNQN_OK=
[ ! -f "/etc/nvme/hostnqn" ] || [ ! -f "/etc/nvme/hostid" ] || NVMF_HOSTNQN_OK=1

if [ -e /tmp/nvmf-fc-auto ] && [ "$NVMF_HOSTNQN_OK" ] \
&& [ -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
# prio 1: cmdline override "rd.nvmf.discovery=fc,auto"
echo add > /sys/class/fc/fc_udev_device/nvme_discovery
[ "$1" = timeout ] || exit 0
fi
if [ -e /tmp/valid_nbft_entry_found ]; then
# prio 2: NBFT
/usr/sbin/nvme connect-nbft
[ "$1" = timeout ] || exit 0
fi
if [ -f /etc/nvme/discovery.conf ] && [ $NVMF_HOSTNQN_OK ]; then
# prio 3: discovery.conf from initrd
/usr/sbin/nvme connect-all
[ "$1" = timeout ] || exit 0
fi
if [ "$NVMF_HOSTNQN_OK" ] \
&& [ -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
# prio 4: no discovery entries, try NVMeoFC autoconnect
echo add > /sys/class/fc/fc_udev_device/nvme_discovery
fi
exit 0
30 changes: 8 additions & 22 deletions modules.d/95nvmf/parse-nvmf-boot-connections.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,11 @@ nbft_parse_hfi() {
# Need to check $? here as he above is an assignment
# shellcheck disable=2181
if [ $? -ne 0 ] && [ "$adrfam" = ipv6 ]; then
prefix=64
prefix=128
fi
# IPv6 has different syntax for prefix/mask
# Use brackets for IPv6
if [ "$adrfam" = ipv6 ]; then
ipaddr="[$ip/$prefix]"
prefix=
ipaddr="[$ipaddr]"
fi

gateway=$(nbft_check_empty_address \
Expand Down Expand Up @@ -302,10 +301,10 @@ if [ -n "$nvmf_hostid" ]; then
echo "$nvmf_hostid" > /etc/nvme/hostid
fi

NVMF_FC_AUTO=
rm -f /tmp/nvmf-fc-auto
for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
parse_nvmf_discover "$d" || {
NVMF_FC_AUTO=1
: > /tmp/nvmf-fc-auto
break
}
done
Expand All @@ -315,19 +314,6 @@ if [ -e /tmp/nvmf_needs_network ] || [ -e /tmp/valid_nbft_entry_found ]; then
rm -f /tmp/nvmf_needs_network
fi

NVMF_HOSTNQN_OK=
[ ! -f "/etc/nvme/hostnqn" ] || [ ! -f "/etc/nvme/hostid" ] || NVMF_HOSTNQN_OK=1

if [ $NVMF_FC_AUTO ] && [ $NVMF_HOSTNQN_OK ]; then
# prio 1: cmdline override "rd.nvmf.discovery=fc,auto"
/sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
elif [ -e /tmp/valid_nbft_entry_found ]; then
# prio 2: NBFT
/sbin/initqueue --settled --onetime --unique --name nvme-connect-nbft /usr/sbin/nvme connect-nbft
elif [ -f /etc/nvme/discovery.conf ] && [ $NVMF_HOSTNQN_OK ]; then
# prio 3: discovery.conf from initrd
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
elif [ $NVMF_HOSTNQN_OK ]; then
# prio 4: no discovery entries, try NVMeoFC autoconnect
/sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
fi
/sbin/initqueue --online --name nvmf-connect-online /sbin/nvmf-autoconnect.sh online
/sbin/initqueue --settled --onetime --name nvmf-connect-settled /sbin/nvmf-autoconnect.sh settled
/sbin/initqueue --timeout --onetime --name nvmf-connect-timeout /sbin/nvmf-autoconnect.sh timeout