]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
feat(nvmf): set rd.neednet=1 if tcp records encountered
authorMartin Wilck <mwilck@suse.com>
Fri, 16 Sep 2022 22:24:38 +0000 (00:24 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Fri, 30 Sep 2022 06:02:18 +0000 (06:02 +0000)
This is currently always the case for NBFT records.
We can do this now, as we run before parse-ip-options.sh

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

index cc545ee0e9a3c85ff39f78d554db2fa528038826..6b26f7625e5cf387303e08474eb3fa8399b8984a 100755 (executable)
@@ -62,7 +62,9 @@ parse_nvmf_discover() {
         warn "traddr is mandatory for $trtype"
         return 0
     fi
-    if [ "$trtype" = "fc" ]; then
+    if [ "$trtype" = "tcp" ]; then
+        : > /tmp/nvmf_needs_network
+    elif [ "$trtype" = "fc" ]; then
         if [ "$traddr" = "auto" ]; then
             rm /etc/nvme/discovery.conf
             return 1
@@ -71,7 +73,7 @@ parse_nvmf_discover() {
             warn "host traddr is mandatory for fc"
             return 0
         fi
-    elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ]; then
+    elif [ "$trtype" != "rdma" ]; then
         warn "unsupported transport $trtype"
         return 0
     fi
@@ -100,6 +102,11 @@ for d in $(getargs rd.nvmf.discover -d nvmf.discover=); do
     }
 done
 
+if [ -e /tmp/nvmf_needs_network ]; then
+    echo "rd.neednet=1" > /etc/cmdline.d/nvmf-neednet.conf
+    rm -f /tmp/nvmf_needs_network
+fi
+
 # Host NQN and host id are mandatory for NVMe-oF
 if [ -f "/etc/nvme/hostnqn" ] && [ -f "/etc/nvme/hostid" ]; then