]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
improvement(74nvmf): lookup required NIC kernel modules for NBFT interfaces
authorTomas Bzatek <tbzatek@redhat.com>
Tue, 3 Jun 2025 16:34:39 +0000 (18:34 +0200)
committerLaszlo <laszlo.gombos@gmail.com>
Mon, 8 Sep 2025 15:23:39 +0000 (11:23 -0400)
When dracut is called with '--hostonly-mode strict' and perhaps even
with --hostonly-nics '' as done by kdump/mkdumprd, all the kernel
modules related to hostonly networking are stripped down. In such
a case it is viable to lookup and install the required kernel modules
ourselves, based on any currently present nbft interfaces.

Note: the lookup depends on the current 'nbftX' network interface
naming.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
modules.d/74nvmf/module-setup.sh

index cf7c35ce253e65c15aa075a00fe2970e1198e2ab..3e64ef745ad9aaed7a8791332dd710a78b53c094 100755 (executable)
@@ -72,6 +72,14 @@ installkernel() {
     hostonly=$(optional_hostonly) instmods nvme_fc nvme_tcp nvme_rdma lpfc qla2xxx
     # 802.1q VLAN may be set up in Firmware later. Include the module always.
     hostonly="" instmods 8021q
+    # lookup NIC kernel modules for active NBFT interfaces
+    if [[ $hostonly ]]; then
+        for i in /sys/class/net/nbft*; do
+            [ -d "$i" ] || continue
+            _driver=$(basename "$(readlink -f "$i/device/driver/module")")
+            [ -z "$_driver" ] || instmods "$_driver"
+        done
+    fi
 }
 
 # called by dracut