]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(nvmf): make sure "rd.nvmf.discover=fc,auto" takes precedence
authorMartin Wilck <mwilck@suse.com>
Fri, 16 Sep 2022 22:51:46 +0000 (00:51 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 30 Sep 2022 06:02:18 +0000 (06:02 +0000)
The command line may contain several rd.nvmf.discover options.
The "fc,auto" option should take precedence.

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

index df104606b27975feb4ebf50f762633c4ea4ffd5a..c8078a76e65e9ad8f5082f476ddf62c798175f05 100755 (executable)
@@ -92,19 +92,21 @@ if [ -n "$nvmf_hostid" ]; then
     echo "$nvmf_hostid" > /etc/nvme/hostid
 fi
 
+NVMF_FC_AUTO=
 for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
-    parse_nvmf_discover "$d" || break
+    parse_nvmf_discover "$d" || {
+        NVMF_FC_AUTO=1
+        break
+    }
 done
 
 # Host NQN and host id are mandatory for NVMe-oF
 [ -f "/etc/nvme/hostnqn" ] || exit 0
 [ -f "/etc/nvme/hostid" ] || exit 0
 
-if [ -f "/etc/nvme/discovery.conf" ]; then
-    /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
+# If no nvme command line arguments present, try autodiscovery
+if [ $NVMF_FC_AUTO ] || [ ! -f "/etc/nvme/discovery.conf" ]; then
+    /sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
 else
-    # No nvme command line arguments present, try autodiscovery
-    if [ "$trtype" = "fc" ]; then
-        /sbin/initqueue --settled --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
-    fi
+    /sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
 fi