Skip to content

Commit 3903b45

Browse files
marian-pritsaklguohan
authored andcommitted
[teamd.sh]: Remove LAG interfaces on exit (#643)
Use -k option for teamd to properly remove LAG interfaces when docker is exiting. Signed-off-by: marian-pritsak <[email protected]>
1 parent cefd024 commit 3903b45

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

dockers/docker-teamd/teamd.sh

+6-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,22 @@
22

33
TEAMD_CONF_PATH=/etc/teamd
44

5-
# Before teamd could automatically add newly created host interfaces into the
6-
# LAG, this workaround will be needed. It will remove the obsolete files and
7-
# net devices that are failed to be removed in the previous run.
85
function start_app {
9-
# Remove *.pid and *.sock files if there are any
106
rm -f /var/run/teamd/*
11-
if [ -d $TEAMD_CONF_PATH ]; then
7+
if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then
128
for f in $TEAMD_CONF_PATH/*; do
13-
# Remove netdevs if there are any
14-
intf=`echo $f | awk -F'[/.]' '{print $4}'`
15-
ip link del $intf
169
teamd -f $f -d
1710
done
1811
fi
1912
teamsyncd &
2013
}
2114

2215
function clean_up {
23-
pkill -9 teamd
16+
if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then
17+
for f in $TEAMD_CONF_PATH/*; do
18+
teamd -f $f -k
19+
done
20+
fi
2421
pkill -9 teamsyncd
2522
exit
2623
}

0 commit comments

Comments
 (0)