commit 3364c49be216e4dcc309c935d03deaf710d82513 Author: Hannes Reinecke Date: Wed Mar 17 14:01:13 2010 +0100 Add 'fcoe-setup.sh' script in contrib Add an fcoe-setup.sh script which creates and configures a VLAN for FCoE. It also creates the required config file for SUSE so that the interface will be started automatically on next reboot. References: bnc#585045 Signed-off-by: Hannes Reinecke diff --git a/contrib/fcoe-setup.sh b/contrib/fcoe-setup.sh new file mode 100755 index 0000000..ab23400 --- /dev/null +++ b/contrib/fcoe-setup.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# +# fcoe-setup.sh +# +# Create VLAN interface for FCoE +# + +scan_vlan() { + local ifname=$1 + local vlan=$2 + + cat /proc/net/vlan/config | tail +3 | while read vif s1 vid s2 if ; do + if [ "$if" = "$ifname" ] && [ "$vid" == "$vlan" ] ; then + echo "$vif" + fi + done +} + +create_vlan () { + local ifname=$1 + local vlan=$2 + local vif + + vif=$(scan_vlan $ifname $vlan) + + if [ -z "$vif" ] ; then + vconfig set_name_type DEV_PLUS_VID_NO_PAD + vconfig add $ifname $vlan > /dev/null + vif="$ifname.$vlan" + fi + ip link set $vif up + echo "$vif" +} + +check_ifcfg () { + local vif=$1 + local ifname=$2 + local vid=$3 + local ifcfg=/etc/sysconfig/network/ifcfg-$vif + + if [ -f "$ifcfg" ] ; then + echo "Interface is configured properly" + else + echo "Creating ifcfg configuration ifcfg-$vif" + cat > $ifcfg < $fcoecfg <