-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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]: Refactor cleanup procedure. #441
Conversation
Depends on: |
Please update this PR when both PR are merged into sonic-swss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update sonic-swss submodule
@stcheng Please help review |
dockers/docker-teamd/Dockerfile.j2
Outdated
@@ -26,5 +26,4 @@ ENV DEBIAN_FRONTEND=noninteractive | |||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | |||
RUN rm -rf /debs | |||
|
|||
ENTRYPOINT ["/bin/bash", "-c"] | |||
CMD ["/usr/bin/config.sh && /usr/bin/start.sh"] | |||
ENTRYPOINT ["/usr/bin/start.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use /bin/bash as ENTRYPOINT and /usr/bin/start.sh as CMD. Thus even when the start.sh fails at some unknown point, the docker won't exit and dev could attach to the docker and debug. The Dockerfile could be similar to docker-orchagent/Dockerfile.j2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dockers/docker-teamd/start.sh
Outdated
pkill -9 teamd | ||
if [ -d $TEAMD_CONF_PATH ]; then | ||
for f in $TEAMD_CONF_PATH/*; do | ||
teamd -f $f -k |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I believe this will successfully stop all the team instances without leaving anything that needs to be manually cleaned up after the next docker starts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-k option kills corresponding daemon and deletes LAG interface
@@ -26,5 +26,5 @@ ENV DEBIAN_FRONTEND=noninteractive | |||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | |||
RUN rm -rf /debs | |||
|
|||
ENTRYPOINT ["/bin/bash", "-c"] | |||
CMD ["/usr/bin/config.sh && /usr/bin/start.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any special reason that we need to merge config.sh and start.sh back into one file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for that is to correctly handle signals sent to container.
See #435
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one issue needs to be addressed.
dockers/docker-teamd/start.sh
Outdated
teamd -f $f -d | ||
done | ||
fi | ||
teamsyncd & | ||
} | ||
|
||
function clean_up { | ||
pkill -9 teamd | ||
if [ -d $TEAMD_CONF_PATH ]; then | ||
for f in $TEAMD_CONF_PATH/*; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if the folder is empty or not. if the folder is empty, the variable f will become /etc/teamd/*.
Signed-off-by: marian-pritsak <marianp@mellanox.com>
Signed-off-by: marian-pritsak <marianp@mellanox.com>
Signed-off-by: marian-pritsak <marianp@mellanox.com>
Rebased and fixed merge conflicts |
Still pending issue #497 |
@marian-pritsak I have tried the patch. I notice that even with |
@stcheng which command did you execute? I did the following test:
I added echo messages into each function for debug, and I can see cleanup is called:
|
@marian-pritsak: I am currently working on a PR that will change all docker ENTRYPOINTs to run supervisord. This will fix issue #435. I say we hold off on merging this PR until after I submit my PR. |
@jleveque thanks. |
@marian-pritsak, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
Includes sonic-swss-common commits: ``` 71dc350 2021-01-07 | Lower the log level for outdated key for SubscriberStateTable notification (sonic-net#441) [Qi Luo] 7e40582 2021-01-08 | Add boost dependencies (sonic-net#442) [Ze Gan] 30a8ddf 2021-01-05 | Change DBConnector::hgetall return type from map to unordered_map (sonic-net#440) [Qi Luo] 021108d 2021-01-02 | MCLAG Enhancements per HLD sonic-net/SONiC#596 (sonic-net#405) [Praveen-Brcm] 54996fc 2021-01-02 | Implement ConfigDBConnector and ConfigDBPipeConnector in C++ (sonic-net#437) [Qi Luo] 8286525 2020-12-27 | Simply refactor DBConnector hgetall() [Qi Luo] 6d1d33b 2020-12-27 | Fix RedisTransactioner: handle empty deque [Qi Luo] 624e0b8 2020-12-26 | Move complex class constructor as explicit, and fix several mistaken copy constructor usage [Qi Luo] 3b983f9 2020-12-30 | [ci]: add timeout to 180 minutes for arm build (sonic-net#439) [lguohan] f2e4210 2020-12-29 | Add utility for string and redis (sonic-net#434) [Ze Gan] 7a885fd 2020-12-29 | [build]: add build check for arm64 and armhf (sonic-net#436) [lguohan] 47bccc4 2020-12-24 | Add missed vector header to rediscommand.h (sonic-net#435) [Ze Gan] ```
Includes sonic-swss-common commits: ``` 71dc350 2021-01-07 | Lower the log level for outdated key for SubscriberStateTable notification (#441) [Qi Luo] 7e40582 2021-01-08 | Add boost dependencies (#442) [Ze Gan] 30a8ddf 2021-01-05 | Change DBConnector::hgetall return type from map to unordered_map (#440) [Qi Luo] 021108d 2021-01-02 | MCLAG Enhancements per HLD sonic-net/SONiC#596 (#405) [Praveen-Brcm] 54996fc 2021-01-02 | Implement ConfigDBConnector and ConfigDBPipeConnector in C++ (#437) [Qi Luo] 8286525 2020-12-27 | Simply refactor DBConnector hgetall() [Qi Luo] 6d1d33b 2020-12-27 | Fix RedisTransactioner: handle empty deque [Qi Luo] 624e0b8 2020-12-26 | Move complex class constructor as explicit, and fix several mistaken copy constructor usage [Qi Luo] 3b983f9 2020-12-30 | [ci]: add timeout to 180 minutes for arm build (#439) [lguohan] f2e4210 2020-12-29 | Add utility for string and redis (#434) [Ze Gan] 7a885fd 2020-12-29 | [build]: add build check for arm64 and armhf (#436) [lguohan] 47bccc4 2020-12-24 | Add missed vector header to rediscommand.h (#435) [Ze Gan] ```
Includes sonic-swss-common commits: ``` 71dc350 2021-01-07 | Lower the log level for outdated key for SubscriberStateTable notification (#441) [Qi Luo] 7e40582 2021-01-08 | Add boost dependencies (#442) [Ze Gan] 30a8ddf 2021-01-05 | Change DBConnector::hgetall return type from map to unordered_map (#440) [Qi Luo] 021108d 2021-01-02 | MCLAG Enhancements per HLD sonic-net/SONiC#596 (#405) [Praveen-Brcm] 54996fc 2021-01-02 | Implement ConfigDBConnector and ConfigDBPipeConnector in C++ (#437) [Qi Luo] 8286525 2020-12-27 | Simply refactor DBConnector hgetall() [Qi Luo] 6d1d33b 2020-12-27 | Fix RedisTransactioner: handle empty deque [Qi Luo] 624e0b8 2020-12-26 | Move complex class constructor as explicit, and fix several mistaken copy constructor usage [Qi Luo] 3b983f9 2020-12-30 | [ci]: add timeout to 180 minutes for arm build (#439) [lguohan] f2e4210 2020-12-29 | Add utility for string and redis (#434) [Ze Gan] 7a885fd 2020-12-29 | [build]: add build check for arm64 and armhf (#436) [lguohan] 47bccc4 2020-12-24 | Add missed vector header to rediscommand.h (#435) [Ze Gan] ```
Signed-off-by: marian-pritsak marianp@mellanox.com