ab92d3
From 809423a5731e4433f3fa08e97ddf152e49cd00bf Mon Sep 17 00:00:00 2001
ab92d3
From: Kairui Song <kasong@redhat.com>
ab92d3
Date: Fri, 13 Nov 2020 18:08:47 +0800
ab92d3
Subject: [PATCH] 95fcoe: don't install if there is no FCoE hostonly devices
ab92d3
ab92d3
When in hostonly mode, 95fcoe module will still be installed even there
ab92d3
is no FCoE hostonly device. So use the new block_is_fcoe helper to check
ab92d3
for hostonly device in hostonly mode, avoid installing unneccessary module.
ab92d3
ab92d3
Signed-off-by: Kairui Song <kasong@redhat.com>
ab92d3
(cherry picked from commit 8c8af8a2cd728e917be8465c79b12149e6877aef)
ab92d3
ab92d3
Resolves: #1899456
ab92d3
---
ab92d3
 modules.d/95fcoe-uefi/module-setup.sh | 17 +++++------------
ab92d3
 modules.d/95fcoe/module-setup.sh      | 11 +++++------
ab92d3
 2 files changed, 10 insertions(+), 18 deletions(-)
ab92d3
ab92d3
diff --git a/modules.d/95fcoe-uefi/module-setup.sh b/modules.d/95fcoe-uefi/module-setup.sh
ab92d3
index a464df5a..9e5719df 100755
ab92d3
--- a/modules.d/95fcoe-uefi/module-setup.sh
ab92d3
+++ b/modules.d/95fcoe-uefi/module-setup.sh
ab92d3
@@ -2,22 +2,15 @@
ab92d3
 
ab92d3
 # called by dracut
ab92d3
 check() {
ab92d3
-    local _fcoe_ctlr
ab92d3
-    [[ $hostonly ]] || [[ $mount_needs ]] && {
ab92d3
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
ab92d3
-            [ -L $c ] || continue
ab92d3
-            _fcoe_ctlr=$c
ab92d3
-        done
ab92d3
-        [ -z "$_fcoe_ctlr" ] && return 255
ab92d3
+    is_fcoe() {
ab92d3
+        block_is_fcoe $1 || return 1
ab92d3
     }
ab92d3
+
ab92d3
     [[ $hostonly ]] || [[ $mount_needs ]] && {
ab92d3
+        for_each_host_dev_and_slaves is_fcoe || return 255
ab92d3
         [ -d /sys/firmware/efi ] || return 255
ab92d3
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
ab92d3
-            [ -L $c ] || continue
ab92d3
-            fcoe_ctlr=$c
ab92d3
-        done
ab92d3
-        [ -z "$fcoe_ctlr" ] && return 255
ab92d3
     }
ab92d3
+
ab92d3
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
ab92d3
     return 0
ab92d3
 }
ab92d3
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
ab92d3
index c2224ec1..f5df705b 100755
ab92d3
--- a/modules.d/95fcoe/module-setup.sh
ab92d3
+++ b/modules.d/95fcoe/module-setup.sh
ab92d3
@@ -2,13 +2,12 @@
ab92d3
 
ab92d3
 # called by dracut
ab92d3
 check() {
ab92d3
-    local _fcoe_ctlr
ab92d3
+    is_fcoe() {
ab92d3
+        block_is_fcoe $1 || return 1
ab92d3
+    }
ab92d3
+
ab92d3
     [[ $hostonly ]] || [[ $mount_needs ]] && {
ab92d3
-        for c in /sys/bus/fcoe/devices/ctlr_* ; do
ab92d3
-            [ -L $c ] || continue
ab92d3
-            _fcoe_ctlr=$c
ab92d3
-        done
ab92d3
-        [ -z "$_fcoe_ctlr" ] && return 255
ab92d3
+        for_each_host_dev_and_slaves is_fcoe || return 255
ab92d3
     }
ab92d3
 
ab92d3
     require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
ab92d3