Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker-teamd]: Automatically start the processes after host interfaces are created #278

Merged
merged 1 commit into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dockers/docker-teamd/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ COPY ["teamd.j2", "/etc/swss/teamd/"]
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

ENTRYPOINT /usr/bin/config.sh && /usr/bin/start.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/config.sh && /usr/bin/start.sh"]
38 changes: 25 additions & 13 deletions dockers/docker-teamd/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,35 @@

TEAMD_CONF_PATH=/etc/teamd

function start_app {
if [ -d $TEAMD_CONF_PATH ]; then
for f in $TEAMD_CONF_PATH/*; do
teamd -f $f -d
done
fi
teamsyncd &
}

function clean_up {
pkill -9 teamd
pkill -9 teamsyncd
service rsyslog stop
exit
pkill -9 teamd
pkill -9 teamsyncd
service rsyslog stop
exit
}

trap clean_up SIGTERM SIGKILL

service rsyslog start

if [ -d $TEAMD_CONF_PATH ]; then
for f in $TEAMD_CONF_PATH/*; do
teamd -f $f -d
done
fi

teamsyncd &

read
# Before teamd could automatically add newly created host interfaces into the
# LAG, this workaround will wait until the host interfaces are created and then
# the processes will be started.
while true; do
# Check if front-panel ports are configured
result=`echo -en "SELECT 0\nHGETALL PORT_TABLE:ConfigDone" | redis-cli | sed -n 3p`
if [ "$result" != "0" ]; then
start_app
read
fi
sleep 1
done