Skip to content

Commit 556ef46

Browse files
mwilckjohannbg
authored andcommitted
fix(nvmf): make sure "rd.nvmf.discover=fc,auto" takes precedence
The command line may contain several rd.nvmf.discover options. The "fc,auto" option should take precedence.
1 parent e93e465 commit 556ef46

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules.d/95nvmf/parse-nvmf-boot-connections.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,21 @@ if [ -n "$nvmf_hostid" ]; then
9292
echo "$nvmf_hostid" > /etc/nvme/hostid
9393
fi
9494

95+
NVMF_FC_AUTO=
9596
for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
96-
parse_nvmf_discover "$d" || break
97+
parse_nvmf_discover "$d" || {
98+
NVMF_FC_AUTO=1
99+
break
100+
}
97101
done
98102

99103
# Host NQN and host id are mandatory for NVMe-oF
100104
[ -f "/etc/nvme/hostnqn" ] || exit 0
101105
[ -f "/etc/nvme/hostid" ] || exit 0
102106

103-
if [ -f "/etc/nvme/discovery.conf" ]; then
104-
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
107+
# If no nvme command line arguments present, try autodiscovery
108+
if [ $NVMF_FC_AUTO ] || [ ! -f "/etc/nvme/discovery.conf" ]; then
109+
/sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
105110
else
106-
# No nvme command line arguments present, try autodiscovery
107-
if [ "$trtype" = "fc" ]; then
108-
/sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
109-
fi
111+
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
110112
fi

0 commit comments

Comments
 (0)