Skip to content

Commit

Permalink
Address comment: modify the code to generic to handle teamd also
Browse files Browse the repository at this point in the history
  • Loading branch information
mlok-nokia committed Sep 19, 2024
1 parent 7f8508f commit 25e2206
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -726,23 +726,20 @@ stop() {
if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then
ip netns delete "$NET_NS"
fi
{%- elif docker_container_name == "teamd" %}
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- elif docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- elif docker_container_name in ["swss", "syncd"] %}
if [[ -f /etc/sonic/chassisdb.conf ]]; then
asic_key=$(sonic-db-cli CHASSIS_STATE_DB keys "CHASSIS_FABRIC_ASIC_TABLE|asic$DEV")
container_id=$(docker ps -a -q -f name="$DOCKERNAME")
if [[ ! -z "$container_id" ]] || [[ ! -z "$asic_key" ]]; then
/usr/local/bin/container stop $DOCKERNAME
fi
{%- else %}
container_id=$(docker ps --filter "name=$DOCKERNAME" --quiet)
if [ -z "$container_id" ]; then
echo "container stop $DOCKERNAME - No such container: $DOCKERNAME"
else
{%- if docker_container_name == "teamd" %}
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- elif docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- else %}
/usr/local/bin/container stop $DOCKERNAME
{%- endif %}
fi
{%- else %}
/usr/local/bin/container stop $DOCKERNAME
{%- endif %}
}

Expand Down

0 comments on commit 25e2206

Please sign in to comment.