forked from dracutdevs/dracut
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nvmf): move connect logic to initqueue script
Rather than trying to connect immediately from parse-nvmf-boot-connections.sh, move the connect logic to an initqueue script which is called at various stages (settle, online, and timeout). In the timeout case, just try every possible connection. Otherwise, use the existing priority logic. Also, make sure that the initqueue script doesn't call exit().
- Loading branch information
Showing
2 changed files
with
36 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters