From 3086e15330cb8ec81569ae9e1c42e43db27338f0 Mon Sep 17 00:00:00 2001 From: marian-pritsak Date: Tue, 30 May 2017 09:45:39 +0300 Subject: [PATCH] [teamd.sh]: Remove LAG interfaces on exit 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 71bc24512ebc..2c7c716b00b7 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 }