From 3903b45d419c7ad7f8f69e5561d4048962a15700 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Thu, 8 Jun 2017 11:53:51 +0300 Subject: [PATCH] [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 --- dockers/docker-teamd/teamd.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/dockers/docker-teamd/teamd.sh b/dockers/docker-teamd/teamd.sh index 71bc24512e..2c7c716b00 100755 --- a/dockers/docker-teamd/teamd.sh +++ b/dockers/docker-teamd/teamd.sh @@ -2,17 +2,10 @@ TEAMD_CONF_PATH=/etc/teamd -# Before teamd could automatically add newly created host interfaces into the -# LAG, this workaround will be needed. It will remove the obsolete files and -# net devices that are failed to be removed in the previous run. function start_app { - # Remove *.pid and *.sock files if there are any rm -f /var/run/teamd/* - if [ -d $TEAMD_CONF_PATH ]; then + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then for f in $TEAMD_CONF_PATH/*; do - # Remove netdevs if there are any - intf=`echo $f | awk -F'[/.]' '{print $4}'` - ip link del $intf teamd -f $f -d done fi @@ -20,7 +13,11 @@ function start_app { } function clean_up { - pkill -9 teamd + if [ "$(ls -A $TEAMD_CONF_PATH)" ]; then + for f in $TEAMD_CONF_PATH/*; do + teamd -f $f -k + done + fi pkill -9 teamsyncd exit }