芝麻web文件管理V1.00
编辑当前文件:/home/conskgoa/doughi.co.uk/95fcoe.zip
PK \x- parse-fcoe.shnu ȯ #!/bin/sh # # Supported formats: # fcoe=
:
:
# fcoe=
:
:
# # Note currently only nodcb is supported, the dcb option is reserved for # future use. # # Note letters in the macaddress must be lowercase! # # Examples: # fcoe=eth0:nodcb:vn2vn # fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then info "rd.fcoe=0: skipping fcoe" return 0 fi [ -z "$fcoe" ] && fcoe=$(getarg fcoe=) # If it's not set we don't continue [ -z "$fcoe" ] && return [ -e /sys/bus/fcoe/ctlr_create ] || modprobe -b -a fcoe || modprobe -b -a libfcoe || die "FCoE requested but kernel/initrd does not support FCoE" initqueue --onetime modprobe -b -q bnx2fc parse_fcoe_opts() { local OLDIFS="$IFS" local IFS=: set $fcoe IFS="$OLDIFS" case $# in 2) fcoe_interface=$1 fcoe_dcb=$2 fcoe_mode="fabric" return 0 ;; 3) fcoe_interface=$1 fcoe_dcb=$2 fcoe_mode=$3 return 0 ;; 7) fcoe_mac=$1:$2:$3:$4:$5:$6 fcoe_dcb=$7 fcoe_mode="fabric" return 0 ;; 8) fcoe_mac=$1:$2:$3:$4:$5:$6 fcoe_dcb=$7 fcoe_mode=$8 return 0 ;; *) warn "Invalid arguments for fcoe=$fcoe" return 1 ;; esac } parse_fcoe_opts if [ "$fcoe_interface" = "edd" ]; then if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then warn "Invalid FCoE DCB option: $fcoe_dcb" fi /sbin/initqueue --settled --unique /sbin/fcoe-edd $fcoe_dcb else for fcoe in $(getargs fcoe=); do unset fcoe_mac unset fcoe_interface parse_fcoe_opts if [ "$fcoe_dcb" != "nodcb" -a "$fcoe_dcb" != "dcb" ] ; then warn "Invalid FCoE DCB option: $fcoe_dcb" fi . $(command -v fcoe-genrules.sh) done fi PK \k* fcoe-genrules.shnu ȯ #!/bin/sh # We use (fcoe_interface or fcoe_mac) and fcoe_dcb as set by parse-fcoe.sh # If neither mac nor interface are set we don't continue [ -z "$fcoe_interface" -a -z "$fcoe_mac" ] && return # Write udev rules { if [ -n "$fcoe_mac" ] ; then printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode" printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode" else printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode" printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode" fi } >> /etc/udev/rules.d/92-fcoe.rules PK \,v cleanup-fcoe.shnu ȯ #!/bin/sh # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh if [ -e /var/run/lldpad.pid ]; then lldpad -k # with systemd version 230, this is not necessary anymore # systemd commit cacf980ed44a28e276a6cc7f8fc41f991e2ab354 if [ -z "$DRACUT_SYSTEMD" ]; then mkdir -m 0755 -p /run/initramfs/state/dev/shm cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1 echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab fi fi PK \%\ \ module-setup.shnu ȯ #!/bin/bash # called by dracut check() { is_fcoe() { block_is_fcoe $1 || return 1 } [[ $hostonly ]] || [[ $mount_needs ]] && { for_each_host_dev_and_slaves is_fcoe || return 255 } require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1 return 0 } # called by dracut depends() { echo network rootfs-block return 0 } # called by dracut installkernel() { instmods fcoe libfcoe 8021q edd bnx2fc } get_vlan_parent() { local link=$1 [ -d $link ] || return read iflink < $link/iflink for if in /sys/class/net/* ; do read idx < $if/ifindex if [ $idx -eq $iflink ] ; then echo ${if##*/} fi done } # called by dracut cmdline() { { for c in /sys/bus/fcoe/devices/ctlr_* ; do [ -L $c ] || continue read enabled < $c/enabled read mode < $c/mode [ $enabled -eq 0 ] && continue if [ $mode = "VN2VN" ] ; then mode="vn2vn" else mode="fabric" fi d=$(cd -P $c; echo $PWD) i=${d%/*} ifname=${i##*/} read mac < ${i}/address s=$(dcbtool gc ${i##*/} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p') if [ -z "$s" ] ; then p=$(get_vlan_parent ${i}) if [ "$p" ] ; then s=$(dcbtool gc ${p} dcb 2>/dev/null | sed -n 's/^DCB State:\t*\(.*\)/\1/p') ifname=${p##*/} fi fi if [ "$s" = "on" ] ; then dcb="dcb" else dcb="nodcb" fi # Some Combined Network Adapters(CNAs) implement DCB in firmware. # Do not run software-based DCB or LLDP on CNAs that implement DCB. # If the network interface provides hardware DCB/DCBX capabilities, # DCB_REQUIRED in "/etc/fcoe/cfg-xxx" is expected to set to "no". # # Force "nodcb" if there's any DCB_REQUIRED="no"(child or vlan parent). grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${i##*/} &>/dev/null [ $? -eq 0 ] && dcb="nodcb" if [ "$p" ] ; then grep -q "^[[:blank:]]*DCB_REQUIRED=\"no\"" /etc/fcoe/cfg-${p} &>/dev/null [ $? -eq 0 ] && dcb="nodcb" fi echo "ifname=${ifname}:${mac}" echo "fcoe=${ifname}:${dcb}:${mode}" done } | sort | uniq } # called by dracut install() { inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm if [ -e "/etc/hba.conf" ]; then inst_libdir_file 'libhbalinux.so*' inst_simple "/etc/hba.conf" fi mkdir -m 0755 -p "$initdir/var/lib/lldpad" mkdir -m 0755 -p "$initdir/etc/fcoe" if [[ $hostonly_cmdline == "yes" ]] ; then local _fcoeconf=$(cmdline) [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf" fi inst_multiple /etc/fcoe/cfg-* inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up" inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd" inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh" inst_hook pre-trigger 03 "$moddir/lldpad.sh" inst_hook cmdline 99 "$moddir/parse-fcoe.sh" inst_hook cleanup 90 "$moddir/cleanup-fcoe.sh" inst_hook shutdown 40 "$moddir/stop-fcoe.sh" dracut_need_initqueue } PK \go o stop-fcoe.shnu ȯ #!/bin/bash for f in /sys/bus/fcoe/devices/ctlr_* ; do [ -e $f ] || continue echo 0 > $f/enabled done PK \i fcoe-up.shnu ȯ #!/bin/sh # # We get called like this: # fcoe-up
# # Note currently only nodcb is supported, the dcb option is reserved for # future use. PATH=/usr/sbin:/usr/bin:/sbin:/bin type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh # Huh? Missing arguments ?? [ -z "$1" -o -z "$2" ] && exit 1 netif=$1 dcb=$2 mode=$3 vlan="yes" iflink=$(cat /sys/class/net/$netif/iflink) ifindex=$(cat /sys/class/net/$netif/ifindex) if [ "$iflink" != "$ifindex" ] ; then # Skip VLAN devices exit 0 fi ip link set dev $netif up linkup "$netif" # Some fcoemon implementations expect --syslog=true syslogopt="--syslog" if fcoemon -h|grep syslog|grep -q yes; then fcoemonyes="$syslogopt=yes" fi netdriver=$(readlink -f /sys/class/net/$netif/device/driver) netdriver=${netdriver##*/} write_fcoemon_cfg() { [ -f /etc/fcoe/cfg-$netif ] && return echo FCOE_ENABLE=\"yes\" > /etc/fcoe/cfg-$netif if [ "$dcb" = "dcb" ]; then echo DCB_REQUIRED=\"yes\" >> /etc/fcoe/cfg-$netif else echo DCB_REQUIRED=\"no\" >> /etc/fcoe/cfg-$netif fi if [ "$vlan" = "yes" ]; then echo AUTO_VLAN=\"yes\" >> /etc/fcoe/cfg-$netif else echo AUTO_VLAN=\"no\" >> /etc/fcoe/cfg-$netif fi if [ "$mode" = "vn2vn" ] ; then echo MODE=\"vn2vn\" >> /etc/fcoe/cfg-$netif else echo MODE=\"fabric\" >> /etc/fcoe/cfg-$netif fi } if [ "$netdriver" = "bnx2x" ]; then # If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan modprobe 8021q udevadm settle --timeout=30 # Sleep for 13 s to allow dcb negotiation sleep 13 fipvlan "$netif" -c -s need_shutdown exit fi if [ "$dcb" = "dcb" ]; then # wait for lldpad to be ready i=0 while [ $i -lt 60 ]; do lldptool -p && break info "Waiting for lldpad to be ready" sleep 1 i=$(($i+1)) done while [ $i -lt 60 ]; do dcbtool sc "$netif" dcb on && break info "Retrying to turn dcb on" sleep 1 i=$(($i+1)) done while [ $i -lt 60 ]; do dcbtool sc "$netif" pfc e:1 a:1 w:1 && break info "Retrying to turn dcb on" sleep 1 i=$(($i+1)) done while [ $i -lt 60 ]; do dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break info "Retrying to turn fcoe on" sleep 1 i=$(($i+1)) done sleep 1 fi write_fcoemon_cfg fcoemon $syslogopt need_shutdown PK \C fcoe-edd.shnu ȯ #!/bin/sh dcb="$1" _modprobe_r_edd="0" check_edd() { local cnt=0 [ -d /sys/firmware/edd ] && return 0 _modprobe_r_edd="1" modprobe edd || return $? while [ $cnt -lt 600 ]; do [ -d /sys/firmware/edd ] && return 0 cnt=$(($cnt+1)) sleep 0.1 done return 1 } check_edd || exit 1 for disk in /sys/firmware/edd/int13_*; do [ -d "$disk" ] || continue if [ -e "${disk}/pci_dev/driver" ]; then driver=$(readlink "${disk}/pci_dev/driver") driver=${driver##*/} fi # i40e uses dev_port 1 for a virtual fcoe function if [ "${driver}" = "i40e" ]; then dev_port=1 fi for nic in "${disk}"/pci_dev/net/*; do [ -d "$nic" ] || continue if [ -n "${dev_port}" -a -e "${nic}/dev_port" ]; then if [ "$(cat ${nic}/dev_port)" -ne "${dev_port}" ]; then continue fi fi if [ -e ${nic}/address ]; then fcoe_interface=${nic##*/} if ! [ -e "/tmp/.fcoe-$fcoe_interface" ]; then /sbin/fcoe-up "$fcoe_interface" "$dcb" > "/tmp/.fcoe-$fcoe_interface" fi fi done done [ "$_modprobe_r_edd" = "1" ] && modprobe -r edd unset _modprobe_r_edd PK \=N lldpad.shnu ȯ #!/bin/bash if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then info "rd.fcoe=0: skipping lldpad activation" return 0 fi # Note lldpad will stay running after switchroot, the system initscripts # are to kill it and start a new lldpad to take over. Data is transfered # between the 2 using a shm segment lldpad -d # wait for lldpad to be ready i=0 while [ $i -lt 60 ]; do lldptool -p && break info "Waiting for lldpad to be ready" sleep 1 i=$(($i+1)) done PK \x- parse-fcoe.shnu ȯ PK \k* 3 fcoe-genrules.shnu ȯ PK \,v ' cleanup-fcoe.shnu ȯ PK \%\ \ module-setup.shnu ȯ PK \go o ! stop-fcoe.shnu ȯ PK \i fcoe-up.shnu ȯ PK \C ' fcoe-edd.shnu ȯ PK \=N , lldpad.shnu ȯ PK e .