Artyom A Anikeev

version for real tests

Showing 1 changed file with 47 additions and 23 deletions
... ... @@ -281,7 +281,8 @@ case "$CMD" in
if [[ "$SLAVE_IS_USED" == 0 ]]; then
#echo "ip link set dev $OLD_SLAVE down"
echo "echo '-$OLD_SLAVE' > /sys/class/net/"$OLD_D1Q_IFACE"/boding/slaves"
#echo "echo '-$OLD_SLAVE' > /sys/class/net/"$OLD_D1Q_IFACE"/bonding/slaves"
echo "-$OLD_SLAVE" > /sys/class/net/"$OLD_D1Q_IFACE"/bonding/slaves
fi
done
D1Q_IS_USED=1
... ... @@ -291,7 +292,8 @@ case "$CMD" in
if [[ "$D1Q_IS_USED" == 0 ]]; then #let's kick out useless d1q
#echo "ip link set dev $OLD_D1Q_IFACE down"
echo "echo '-$D1Q_IFACE' > /sys/class/net/bonding_masters"
#echo "echo '-$D1Q_IFACE' > /sys/class/net/bonding_masters"
echo "-$D1Q_IFACE" > /sys/class/net/bonding_masters
fi
done
... ... @@ -314,8 +316,10 @@ case "$CMD" in
fi
done
if [[ "$SLAVE_EXISTS" == 0 ]]; then
echo "ip link set dev $SLAVE down" #enslaved int should be shutted down
echo "echo '+$SLAVE' > /sys/class/net/"$D1Q_IFACE"/bonding/slaves"
#echo "ip link set dev $SLAVE down" #enslaved int should be shutted down
ip link set dev "$SLAVE" down #enslaved int should be shutted down
#echo "echo '+$SLAVE' > /sys/class/net/"$D1Q_IFACE"/bonding/slaves"
echo "+$SLAVE" > /sys/class/net/"$D1Q_IFACE"/bonding/slaves
fi
done
D1Q_EXISTS=1
... ... @@ -324,11 +328,14 @@ case "$CMD" in
done
if [[ "$D1Q_EXISTS" == 0 ]]; then #make all
echo "echo '+$D1Q_IFACE' > /sys/class/net/bonding_masters"
#echo "echo '+$D1Q_IFACE' > /sys/class/net/bonding_masters"
echo "+$D1Q_IFACE" > /sys/class/net/bonding_masters
for SLAVE in "${!SLAVES_VARIABLE}"; do
echo "ip link set dev $SLAVE down" #enslaved int should be shutted down
echo "echo '+$SLAVE' > /sys/class/net/"$D1Q_IFACE"/bonding/slaves"
#echo "ip link set dev $SLAVE down" #enslaved int should be shutted down
ip link set dev "$SLAVE" down #enslaved int should be shutted down
#echo "echo '+$SLAVE' > /sys/class/net/"$D1Q_IFACE"/bonding/slaves"
echo "+$SLAVE" > /sys/class/net/"$D1Q_IFACE"/bonding/slaves
done
fi
... ... @@ -336,7 +343,8 @@ case "$CMD" in
echo "ip link set dev $D1Q_IFACE up"
for SLAVE in "${!SLAVES_VARIABLE}"; do #slave starts after bond
echo "ip link set dev $SLAVE up"
#echo "ip link set dev $SLAVE up"
ip link set dev "$SLAVE" up
done
VLAN_N_BRIDGE_VARIABLE="${D1Q_IFACE}_VLAN_N_BRIDGES"
... ... @@ -393,13 +401,17 @@ case "$CMD" in
done
if [[ "$VLAN_N_BRIDGE_IN_USE" = 0 ]]; then
echo "ip link set $OLD_VLANNAME nomaster"
#echo "ip link set $OLD_VLANNAME nomaster"
ip link set "$OLD_VLANNAME" nomaster
fi
if [[ "$VLAN_IN_USE" = 0 ]]; then
echo "ip link delete $OLD_VLANNAME"
#echo "ip link delete $OLD_VLANNAME"
ip link delete "$OLD_VLANNAME"
fi
if [[ "$BRIDGE_IN_USE" = 0 ]]; then
echo "ip link delete $OLD_BRNAME"
#echo "ip link delete $OLD_BRNAME"
ip link delete "$OLD_BRNAME"
fi
fi
... ... @@ -436,14 +448,20 @@ case "$CMD" in
echo D1Q_IFACE $D1Q_IFACE
##
if [[ "`ip link show | grep "$FULL_PARVLAN_NAME"`" = "" ]]; then #should we create a new parent vlan?
echo "ip link add link $D1Q_IFACE name $FULL_PARVLAN_NAME type vlan id $VLAN" #vlan in bond
echo "ip link set dev $FULL_PARVLAN_NAME up"
#echo "ip link add link $D1Q_IFACE name $FULL_PARVLAN_NAME type vlan id $VLAN" #vlan in bond
ip link add link "$D1Q_IFACE" name "$FULL_PARVLAN_NAME" type vlan id "$VLAN" #vlan in bond
#echo "ip link set dev $FULL_PARVLAN_NAME up"
ip link set dev "$FULL_PARVLAN_NAME" up
fi
echo "ip link add link $FULL_PARVLAN_NAME name $FULL_VLAN_NAME type vlan id $SUBVLAN" #subvlan in vlan
echo "ip link set dev $FULL_VLAN_NAME up"
#echo "ip link add link $FULL_PARVLAN_NAME name $FULL_VLAN_NAME type vlan id $SUBVLAN" #subvlan in vlan
ip link add link "$FULL_PARVLAN_NAME" name "$FULL_VLAN_NAME" type vlan id "$SUBVLAN" #subvlan in vlan
#echo "ip link set dev $FULL_VLAN_NAME up"
ip link set dev "$FULL_VLAN_NAME" up
else
echo "ip link add link $D1Q_IFACE name $FULL_VLAN_NAME type vlan id $VLANNAME" #vlan in bond
echo "ip link set dev $FULL_VLAN_NAME up"
#echo "ip link add link $D1Q_IFACE name $FULL_VLAN_NAME type vlan id $VLANNAME" #vlan in bond
ip link add link "$D1Q_IFACE" name "$FULL_VLAN_NAME" type vlan id "$VLANNAME" #vlan in bond
#echo "ip link set dev $FULL_VLAN_NAME up"
ip link set dev "$FULL_VLAN_NAME" up
fi
fi
fi
... ... @@ -455,7 +473,8 @@ case "$CMD" in
#if [[ "`brctl show | grep "$BRNAME"`" = "" ]]; then #do this bridge exists?
if [[ "`ip link show | grep "$BRNAME"`" = "" ]]; then #do this bridge exists?
#brctl addbr "$BRNAME"
echo "ip link add "$BRNAME" type bridge"
#echo "ip link add "$BRNAME" type bridge"
ip link add "$BRNAME" type bridge
fi
if [[ "$VLAN" != "" ]]; then
... ... @@ -463,14 +482,19 @@ case "$CMD" in
OLD_BRNAME="`ip link show | grep master | grep "FULL_VLANNAME" | awk '{printf $9}'`"
if [[ "$OLD_BRNAME" = "" ]]; then #is this vlan nave been already enslaved?
#brctl addif "$BRNAME" "$FULL_VLANNAME"
echo "ip link set "$FULL_VLAN_NAME" master "$BRNAME
echo "ip link set dev $BRNAME up"
#echo "ip link set "$FULL_VLAN_NAME" master "$BRNAME
ip link set "$FULL_VLAN_NAME" master "$BRNAME"
#echo "ip link set dev $BRNAME up"
ip link set dev "$BRNAME" up
else
#brctl delif "$OLD_BRNAME" "FULL_VLANNAME"
echo "ip link set "$FULL_VLAN_NAME" nomaster"
#echo "ip link set "$FULL_VLAN_NAME" nomaster"
ip link set "$FULL_VLAN_NAME" nomaster
#brctl addif "$BRNAME" "$FULL_VLANNAME"
echo "ip link set "$FULL_VLAN_NAME" master "$BRNAME
echo "ip link set dev $BRNAME up"
#echo "ip link set "$FULL_VLAN_NAME" master "$BRNAME
ip link set "$FULL_VLAN_NAME" master "$BRNAME"
#echo "ip link set dev $BRNAME up"
ip link set dev "$BRNAME" up
fi
fi
fi
... ...