]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(nvmf): require NVMeoF modules
authorMartin Wilck <mwilck@suse.com>
Fri, 6 Sep 2024 11:36:41 +0000 (13:36 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Wed, 11 Sep 2024 12:06:55 +0000 (08:06 -0400)
Signed-off-by: Martin Wilck <mwilck@suse.com>
modules.d/95nvmf/module-setup.sh

index c2cf0fb7bcd1c67b0469579fbcb53e287b25f68a..15b74b78a64a6f44dbe5ad013a76de14d1d6ba2e 100755 (executable)
@@ -2,7 +2,10 @@
 
 # called by dracut
 check() {
+    local -A nvmf_trtypes
+
     require_binaries nvme jq || return 1
+    require_kernel_modules nvme_fabrics || return 1
 
     # shellcheck disable=SC2317  # called later by for_each_host_dev_and_slaves
     is_nvmf() {
@@ -21,7 +24,12 @@ check() {
                 break
             fi
         done
-        [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]
+        if [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]; then
+            nvmf_trtypes["nvme_${trtype}"]=1
+            return 0
+        else
+            return 1
+        fi
     }
 
     has_nbft() {
@@ -42,6 +50,7 @@ check() {
         local _is_nvmf=$?
         popd > /dev/null || exit
         [[ $_is_nvmf == 0 ]] || return 255
+        require_kernel_modules "${!nvmf_trtypes[@]}" || return 1
         if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ] \
             && [ ! -f /etc/nvme/discovery.conf ] \
             && [ ! -f /etc/nvme/config.json ] && ! has_nbft; then