]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
95fcoe: don't install if there is no FCoE hostonly devices
authorKairui Song <kasong@redhat.com>
Fri, 13 Nov 2020 10:08:47 +0000 (18:08 +0800)
committerDaniel Molkentin <daniel@molkentin.de>
Mon, 23 Nov 2020 16:23:38 +0000 (17:23 +0100)
When in hostonly mode, 95fcoe module will still be installed even there
is no FCoE hostonly device. So use the new block_is_fcoe helper to check
for hostonly device in hostonly mode, avoid installing unneccessary module.

Signed-off-by: Kairui Song <kasong@redhat.com>
modules.d/95fcoe-uefi/module-setup.sh
modules.d/95fcoe/module-setup.sh

index a464df5a04ab502dba85aa4a1c555a15544ebba8..9e5719dfb19f17ac8bd76619e220578c47df3c19 100755 (executable)
@@ -2,22 +2,15 @@
 
 # called by dracut
 check() {
-    local _fcoe_ctlr
-    [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
-            [ -L $c ] || continue
-            _fcoe_ctlr=$c
-        done
-        [ -z "$_fcoe_ctlr" ] && return 255
+    is_fcoe() {
+        block_is_fcoe $1 || return 1
     }
+
     [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for_each_host_dev_and_slaves is_fcoe || return 255
         [ -d /sys/firmware/efi ] || return 255
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
-            [ -L $c ] || continue
-            fcoe_ctlr=$c
-        done
-        [ -z "$fcoe_ctlr" ] && return 255
     }
+
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
     return 0
 }
index 9b9e6c5c1b55bcd7f2ad1533784ba966417b735f..d98d5c0aef0b5ecfa1422994ca8e02f530b9bc63 100755 (executable)
@@ -2,13 +2,12 @@
 
 # called by dracut
 check() {
-    local _fcoe_ctlr
+    is_fcoe() {
+        block_is_fcoe $1 || return 1
+    }
+
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
-            [ -L $c ] || continue
-            _fcoe_ctlr=$c
-        done
-        [ -z "$_fcoe_ctlr" ] && return 255
+        for_each_host_dev_and_slaves is_fcoe || return 255
     }
 
     require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1