Skip to content

Commit

Permalink
detach bonding slaves if WWPOSTNETDOWN is set
Browse files Browse the repository at this point in the history
  • Loading branch information
beinvisible authored and bensallen committed May 14, 2019
1 parent 2d57963 commit af22a39
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion provision/initramfs/init
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ bondup() {
while [ $COUNT -le $WWNETRETRY ]; do
if ping -c 1 $WWMASTER >/dev/null 2>&1; then
wwsuccess
WWBONDINGDEV=$DEVICE
return 0
fi
msg_white "."
Expand All @@ -218,7 +219,8 @@ bondup() {

# If we have gotten here, give up for this device, and bring device down
# just in case its present.
ip link set dev $DEVICE down >/dev/null 2>&1
# ip link del also releases the slaves
ip link del dev $DEVICE >/dev/null
return 255
}

Expand Down Expand Up @@ -533,10 +535,12 @@ if [ -x "$NEWROOT/sbin/init" -o -h "$NEWROOT/sbin/init" ]; then
else
wwfailure
fi

if [ -n "$WWPOSTNETDOWN" ]; then
NETDEV=`cat /tmp/wwdev`
if [ -f "/tmp/ifcfg-$WWNETDEV" ]; then
. /tmp/ifcfg-$WWNETDEV

if [ -n "$IPADDR" -a -n "$NETMASK" ]; then
wwlogger "Deleting network interface address $NETDEV:$IPADDR/$NETMASK ($WWNETDEV)"
msg_white "Deleting network interface address $NETDEV:$IPADDR/$NETMASK ($WWNETDEV)"
Expand Down Expand Up @@ -568,6 +572,13 @@ if [ -x "$NEWROOT/sbin/init" -o -h "$NEWROOT/sbin/init" ]; then
msg_white "Could not bring down $NETDEV ($WWNETDEV)"
wwfailure
fi

# did we create a bonding device?
if [ -n "$WWBONDINGDEV" ]; then
# Delete bonding device. This will also detach the slaves.
# Deliberately not use NETDEV here; bondup() never guesses device names.
ip link del dev $WWBONDINGDEV >/dev/null
fi
fi

mkdir -p $NEWROOT${WWBOOTSTRAPLOGS:-/var/log} >/dev/null 2>&1
Expand Down

0 comments on commit af22a39

Please sign in to comment.