From 809423a5731e4433f3fa08e97ddf152e49cd00bf Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Fri, 13 Nov 2020 18:08:47 +0800 Subject: [PATCH] 95fcoe: don't install if there is no FCoE hostonly devices 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 (cherry picked from commit 8c8af8a2cd728e917be8465c79b12149e6877aef) Resolves: #1899456 --- modules.d/95fcoe-uefi/module-setup.sh | 17 +++++------------ modules.d/95fcoe/module-setup.sh | 11 +++++------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/modules.d/95fcoe-uefi/module-setup.sh b/modules.d/95fcoe-uefi/module-setup.sh index a464df5a..9e5719df 100755 --- a/modules.d/95fcoe-uefi/module-setup.sh +++ b/modules.d/95fcoe-uefi/module-setup.sh @@ -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 } diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh index c2224ec1..f5df705b 100755 --- a/modules.d/95fcoe/module-setup.sh +++ b/modules.d/95fcoe/module-setup.sh @@ -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