Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/dracut/modules..../95fcoe
File: fcoe-up.sh
#!/bin/sh
[0] Fix | Delete
#
[1] Fix | Delete
# We get called like this:
[2] Fix | Delete
# fcoe-up <network-device> <dcb|nodcb> <fabric|vn2vn>
[3] Fix | Delete
#
[4] Fix | Delete
# Note currently only nodcb is supported, the dcb option is reserved for
[5] Fix | Delete
# future use.
[6] Fix | Delete
[7] Fix | Delete
PATH=/usr/sbin:/usr/bin:/sbin:/bin
[8] Fix | Delete
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
[9] Fix | Delete
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
[10] Fix | Delete
[11] Fix | Delete
# Huh? Missing arguments ??
[12] Fix | Delete
[ -z "$1" -o -z "$2" ] && exit 1
[13] Fix | Delete
[14] Fix | Delete
netif=$1
[15] Fix | Delete
dcb=$2
[16] Fix | Delete
mode=$3
[17] Fix | Delete
vlan="yes"
[18] Fix | Delete
[19] Fix | Delete
iflink=$(cat /sys/class/net/$netif/iflink)
[20] Fix | Delete
ifindex=$(cat /sys/class/net/$netif/ifindex)
[21] Fix | Delete
if [ "$iflink" != "$ifindex" ] ; then
[22] Fix | Delete
# Skip VLAN devices
[23] Fix | Delete
exit 0
[24] Fix | Delete
fi
[25] Fix | Delete
[26] Fix | Delete
ip link set dev $netif up
[27] Fix | Delete
linkup "$netif"
[28] Fix | Delete
[29] Fix | Delete
# Some fcoemon implementations expect --syslog=true
[30] Fix | Delete
syslogopt="--syslog"
[31] Fix | Delete
if fcoemon -h|grep syslog|grep -q yes; then
[32] Fix | Delete
fcoemonyes="$syslogopt=yes"
[33] Fix | Delete
fi
[34] Fix | Delete
[35] Fix | Delete
[36] Fix | Delete
netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
[37] Fix | Delete
netdriver=${netdriver##*/}
[38] Fix | Delete
[39] Fix | Delete
write_fcoemon_cfg() {
[40] Fix | Delete
[ -f /etc/fcoe/cfg-$netif ] && return
[41] Fix | Delete
echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif
[42] Fix | Delete
if [ "$dcb" = "dcb" ]; then
[43] Fix | Delete
echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif
[44] Fix | Delete
else
[45] Fix | Delete
echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif
[46] Fix | Delete
fi
[47] Fix | Delete
if [ "$vlan" = "yes" ]; then
[48] Fix | Delete
echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif
[49] Fix | Delete
else
[50] Fix | Delete
echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif
[51] Fix | Delete
fi
[52] Fix | Delete
if [ "$mode" = "vn2vn" ] ; then
[53] Fix | Delete
echo MODE=\"vn2vn\" >> /etc/fcoe/cfg-$netif
[54] Fix | Delete
else
[55] Fix | Delete
echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif
[56] Fix | Delete
fi
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
if [ "$netdriver" = "bnx2x" ]; then
[60] Fix | Delete
# If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
[61] Fix | Delete
modprobe 8021q
[62] Fix | Delete
udevadm settle --timeout=30
[63] Fix | Delete
# Sleep for 13 s to allow dcb negotiation
[64] Fix | Delete
sleep 13
[65] Fix | Delete
fipvlan "$netif" -c -s
[66] Fix | Delete
need_shutdown
[67] Fix | Delete
exit
[68] Fix | Delete
fi
[69] Fix | Delete
if [ "$dcb" = "dcb" ]; then
[70] Fix | Delete
# wait for lldpad to be ready
[71] Fix | Delete
i=0
[72] Fix | Delete
while [ $i -lt 60 ]; do
[73] Fix | Delete
lldptool -p && break
[74] Fix | Delete
info "Waiting for lldpad to be ready"
[75] Fix | Delete
sleep 1
[76] Fix | Delete
i=$(($i+1))
[77] Fix | Delete
done
[78] Fix | Delete
[79] Fix | Delete
while [ $i -lt 60 ]; do
[80] Fix | Delete
dcbtool sc "$netif" dcb on && break
[81] Fix | Delete
info "Retrying to turn dcb on"
[82] Fix | Delete
sleep 1
[83] Fix | Delete
i=$(($i+1))
[84] Fix | Delete
done
[85] Fix | Delete
[86] Fix | Delete
while [ $i -lt 60 ]; do
[87] Fix | Delete
dcbtool sc "$netif" pfc e:1 a:1 w:1 && break
[88] Fix | Delete
info "Retrying to turn dcb on"
[89] Fix | Delete
sleep 1
[90] Fix | Delete
i=$(($i+1))
[91] Fix | Delete
done
[92] Fix | Delete
[93] Fix | Delete
while [ $i -lt 60 ]; do
[94] Fix | Delete
dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
[95] Fix | Delete
info "Retrying to turn fcoe on"
[96] Fix | Delete
sleep 1
[97] Fix | Delete
i=$(($i+1))
[98] Fix | Delete
done
[99] Fix | Delete
[100] Fix | Delete
sleep 1
[101] Fix | Delete
fi
[102] Fix | Delete
write_fcoemon_cfg
[103] Fix | Delete
fcoemon $syslogopt
[104] Fix | Delete
[105] Fix | Delete
need_shutdown
[106] Fix | Delete
[107] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function