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