Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
sysconfig
> sysconfig_infiniband_bonding.fate-303388.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File sysconfig_infiniband_bonding.fate-303388.patch of Package sysconfig (Revision 1)
Currently displaying revision
1
,
show latest
--- scripts/functions +++ scripts/functions 2008/01/31 16:52:05 @@ -80,6 +80,57 @@ echo ${octet[1]}.${octet[2]}.${octet[3]}.${octet[4]} } +create_ib_child_iface() { + # e.g. ib0.8001 + IBIFACE=$1 + + IBPARENT=${IBIFACE%%\.*} + IBCHILD=${IBIFACE#*\.} + + # Check if the device name is ib0, ib1 etc. + if [ "${IBPARENT:0:2}" != "ib" ] ; then + return 1 + fi + # Check if the devices does not contain a "." + if [ "${IBCHILD}" == "${IBIFACE}" ] ; then + return 1 + fi + if [ -d "/sys/class/net/${IBPARENT}.${IBCHILD}" ] ; then + return 0 + fi + if [ -e "/sys/class/net/${IBPARENT}/create_child" ] ; then + echo "0x${IBCHILD}" > "/sys/class/net/${IBPARENT}/create_child" + ip link show dev "${IBPARENT}.${IBCHILD}" &>/dev/null + else + return 1 + fi +} +delete_ib_child_iface() { + # e.g. ib0.8001 + IBIFACE=$1 + + IBPARENT=${IBIFACE%%\.*} + IBCHILD=${IBIFACE#*\.} + + # Check if the device name is ib0, ib1 etc. + if [ "${IBPARENT:0:2}" != "ib" ] ; then + return 1 + fi + # Check if the devices does not contain a "." + if [ "${IBCHILD}" == "${IBIFACE}" ] ; then + return 1 + fi + if [ ! -d "/sys/class/net/${IBPARENT}.${IBCHILD}" ] ; then + return 0 + fi + if [ -e "/sys/class/net/${IBPARENT}/delete_child" ] ; then + echo "0x${IBCHILD}" > "/sys/class/net/${IBPARENT}/delete_child" + [ -d "/sys/class/net/${IBPARENT}.${IBCHILD}" ] || return 0 + else + return 1 + fi +} + is_iface_available () { test -z "$1" && return 1 case $1 in @@ -87,6 +138,7 @@ modem*|dsl*|ppp*) return 0 ;; vlan*) return 0 ;; sit*|gre*|ipip*) return 0 ;; + ib*) return 0 ;; esac test "${SCRIPTNAME%%-*}" = ifdown -a "$MODE" = hotplug && return 0 test "${SCRIPTNAME%%-*}" = ifup -a "$BONDING_MASTER" = yes && return 0 @@ -512,11 +564,12 @@ DEP_IFACES="$DEP_VLANS" fi - if [ -d "$BOND_PATH" ]; then - DEP_BONDS=`cd "$BOND_PATH" - grep -lws "Slave Interface: *$BASE_IFACE" *` - DEP_IFACES="$DEP_IFACES${DEP_BONDS:+ $DEP_BONDS}" - fi + ## don't trigger down of bond interface when a slave goes down + #if [ -d "$BOND_PATH" ]; then + # DEP_BONDS=`cd "$BOND_PATH" + # grep -lws "Slave Interface: *$BASE_IFACE" *` + # DEP_IFACES="$DEP_IFACES${DEP_BONDS:+ $DEP_BONDS}" + #fi if [ -z "$DEP_IFACES" ]; then return 1 --- scripts/ifup +++ scripts/ifup 2008/01/31 16:32:25 @@ -919,7 +919,11 @@ logerror "Could not get an interface for slave device '$BONDING_SLAVE'" fi # prepare only available slave devices - if [ -d /sys/class/net/$BSIFACE ] ; then + if [ "${BSIFACE:0:2}" = "ib" ] ; then + IBSLAVES="yes" + create_ib_child_iface $BSIFACE + fi + if [ -d "/sys/class/net/$BSIFACE" ] ; then BSINTERFACES="$BSINTERFACES $BSIFACE" else logerror "Bonding Slave $BSIFACE is not available. Skipped." @@ -934,7 +938,14 @@ ip link set $INTERFACE up 2>&1 # fi # enslave available slave devices; if there is none -> hard break and log - MESSAGE=`/sbin/ifenslave $BONDING_OPTIONS $INTERFACE $BSINTERFACES 2>&1` + if [ "X${IBSLAVES}" = "Xyes" ] ; then + for BSINTERFACE in ${BSINTERFACES} ; do + ip link set dev ${BSINTERFACE} down + echo +${BSINTERFACE} > /sys/class/net/$INTERFACE/bonding/slaves + done + else + MESSAGE=`/sbin/ifenslave $BONDING_OPTIONS $INTERFACE $BSINTERFACES 2>&1` + fi if [ "$?" -gt 0 ]; then logerror "Bonding interface '$INTERFACE' could not be set up" \ "correctly\n$MESSAGE" @@ -1213,6 +1224,17 @@ # If this is an bonding master, remove it if [ "$BONDING_MASTER" = yes ] ; then remove_bond $INTERFACE + + # and delete ib children we've created + for BSVAR in ${!BONDING_SLAVE*} ; do + BONDING_SLAVE=${!BSVAR} + BSIFACE="`/sbin/getcfg-interface -- $BONDING_SLAVE 2>/dev/null`" + if [ "${BSIFACE:0:2}" = "ib" ] ; then + delete_ib_child_iface $BSIFACE + fi + done + elif [ -e /sys/class/net/$INTERFACE/master/bonding/slaves ] ; then + echo "-${INTERFACE}" > /sys/class/net/$INTERFACE/master/bonding/slaves fi retcode=0 # $? ;;