-
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-orchagent]: Properly manage with supervisord #589
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit immediately upon error | ||
set -e | ||
|
||
function start_app { | ||
orchagent $ORCHAGENT_ARGS & | ||
portsyncd $PORTSYNCD_ARGS & | ||
intfsyncd & | ||
neighsyncd & | ||
for file in $SWSSCONFIG_ARGS | ||
do | ||
swssconfig /etc/swss/config.d/$file | ||
sleep 1 | ||
done | ||
} | ||
|
||
function config_acl { | ||
if [ -f "/etc/sonic/acl.json" ]; then | ||
mkdir -p /etc/swss/config.d/acl | ||
rm -rf /etc/swss/config.d/acl/* | ||
translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json | ||
for filename in /etc/swss/config.d/acl/*.json; do | ||
[ -e "$filename" ] || break | ||
swssconfig $filename | ||
done | ||
fi | ||
} | ||
|
||
function clean_up { | ||
pkill -9 orchagent | ||
pkill -9 portsyncd | ||
pkill -9 intfsyncd | ||
pkill -9 neighsyncd | ||
exit | ||
} | ||
|
||
trap clean_up SIGTERM SIGKILL | ||
|
||
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` | ||
|
||
MAC_ADDRESS=`ip link show eth0 | grep ether | awk '{print $2}'` | ||
|
||
ORCHAGENT_ARGS="" | ||
|
||
PORTSYNCD_ARGS="-p /usr/share/sonic/hwsku/port_config.ini" | ||
|
||
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " | ||
|
||
if [ "$HWSKU" == "Force10-S6000" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " | ||
elif [ "$HWSKU" == "Force10-S6100" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
elif [ "$HWSKU" == "Force10-Z9100" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
elif [ "$HWSKU" == "Arista-7050-QX32" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " | ||
elif [ "$HWSKU" == "Arista-7060-CX32S" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
elif [ "$HWSKU" == "AS7512" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
elif [ "$HWSKU" == "INGRASYS-S9100-C32" ]; then | ||
ORCHAGENT_ARGS+="-m $MAC_ADDRESS" | ||
elif [ "$HWSKU" == "ACS-MSN2700" ]; then | ||
SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " | ||
fi | ||
|
||
while true; do | ||
# Check if syncd starts | ||
result=`echo -en "SELECT 1\nHLEN HIDDEN" | redis-cli | sed -n 2p` | ||
if [ "$result" != "0" ]; then | ||
start_app | ||
config_acl | ||
read | ||
fi | ||
sleep 1 | ||
done | ||
exec /usr/bin/orchagent ${ORCHAGENT_ARGS} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
function config_acl { | ||
if [ -f "/etc/sonic/acl.json" ]; then | ||
mkdir -p /etc/swss/config.d/acl | ||
rm -rf /etc/swss/config.d/acl/* | ||
translate_acl -m /etc/sonic/minigraph.xml -o /etc/swss/config.d/acl /etc/sonic/acl.json | ||
for filename in /etc/swss/config.d/acl/*.json; do | ||
[ -e "$filename" ] || break | ||
swssconfig $filename | ||
done | ||
fi | ||
} | ||
|
||
HWSKU=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku` | ||
|
||
SWSSCONFIG_ARGS="00-copp.config.json ipinip.json mirror.json " | ||
|
||
if [ "$HWSKU" == "Force10-S6000" ]; then | ||
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " | ||
elif [ "$HWSKU" == "Arista-7050-QX32" ]; then | ||
SWSSCONFIG_ARGS+="td2.32ports.buffers.json td2.32ports.qos.json " | ||
elif [ "$HWSKU" == "ACS-MSN2700" ]; then | ||
SWSSCONFIG_ARGS+="msn2700.32ports.buffers.json msn2700.32ports.qos.json " | ||
fi | ||
|
||
for file in $SWSSCONFIG_ARGS; do | ||
swssconfig /etc/swss/config.d/$file | ||
sleep 1 | ||
done | ||
|
||
config_acl | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
to rename it just to config.sh? swssconfig.sh will be confused with swssconfig script.
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.
@stcheng: I've been using this naming convention for supervisord. Basically, if a process requires more than one command to start properly, I've been wrapping them in a shell script named after the process. I think "config.sh" is not descriptive enough and can't be used as a convention. Maybe
orchagent_start.sh
andswssconfig_start.sh
?Also, is this really necessary?
/usr/bin/orchagent
and/usr/bin/swssconfig
are binaries, not scripts, so do you think there could really be that much confusion?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.
okay. i see your point.
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 see yours as well. This has the potential to get confusing in the future. I'll consider submitting a PR that changes the names of all of these new process start scripts at once.