6 # If our prerequisites are not met, fail anyways.
7 require_binaries iscsistart hostname iscsi-iname ||
return 1
9 # If hostonly was requested, fail the check if we are not actually
15 [[ -L "/sys/dev/block/$_dev" ]] ||
return
16 cd "$(readlink -f "/sys
/dev
/block
/$_dev")"
17 until [[ -d sys ||
-d iscsi_session
]]; do
20 [[ -d iscsi_session
]]
23 [[ $hostonly ]] ||
[[ $mount_needs ]] && {
25 for_each_host_dev_and_slaves is_iscsi ||
return 255
33 # Return the iSCSI offload module for a given MAC address
34 iscsiadm
-m iface |
while read iface_name iface_desc
; do
37 if [ "$ibft_mac" = "$2" ] ; then
46 # When iBFT / iscsi_boot is detected:
47 # - Use 'ip=ibft' to set up iBFT network interface
48 # Note: bnx2i is using a different MAC address of iSCSI offloading
49 # so the 'ip=ibft' parameter must not be set
50 # - specify firmware booting cmdline parameter
52 for d
in /sys
/firmware
/* ; do
53 if [ -d ${d}/ethernet0
] ; then
54 read ibft_mac
< ${d}/ethernet
0/mac
55 ibft_mod
=$
(get_ibft_mod
$ibft_mac)
57 if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1
] ; then
58 read ibft_mac
< ${d}/ethernet
1/mac
59 ibft_mod
=$
(get_ibft_mod
$ibft_mac)
61 if [ -d ${d}/initiator
] ; then
62 if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
65 echo -n "rd.iscsi.firmware=1"
72 echo network rootfs-block
77 local _arch
=$
(uname
-m)
79 instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
80 hostonly
="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
81 iscsi_module_filter
() {
82 local _funcs
='iscsi_register_transport'
83 # subfunctions inherit following FDs
84 local _merge
=8 _side2
=9
89 *.ko
) [[ $
(< $_f) =~
$_funcs ]] && echo "$_f" ;;
90 *.ko.gz
) [[ $
(gzip -dc <$_f) =~
$_funcs ]] && echo "$_f" ;;
91 *.ko.xz
) [[ $
(xz
-dc <$_f) =~
$_funcs ]] && echo "$_f" ;;
102 echo "$_f2" 1>&${_side2}
104 done | bmf1
1>&${_merge}
107 # Use two parallel streams to filter alternating modules.
109 eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1"
110 [[ $debug ]] && set -x
114 { find_kernel_modules_by_path drivers
/scsi
; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers
/s390
/scsi
; fi;} \
115 | iscsi_module_filter | instmods
125 inst_multiple umount iscsistart hostname iscsi-iname
126 inst_multiple
-o iscsiuio
127 inst_libdir_file
'libgcc_s.so*'
129 # Detect iBFT and perform mandatory steps
130 if [[ $hostonly_cmdline == "yes" ]] ; then
131 local _ibftconf
=$
(install_ibft
)
132 [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
135 inst_hook cmdline
90 "$moddir/parse-iscsiroot.sh"
136 inst_hook cleanup
90 "$moddir/cleanup-iscsi.sh"
137 inst
"$moddir/iscsiroot.sh" "/sbin/iscsiroot"
138 if ! dracut_module_included
"systemd"; then
139 inst
"$moddir/mount-lun.sh" "/bin/mount-lun.sh"
141 dracut_need_initqueue