[service dependent] describe non-warm-reboot dependency outside systemd (#3311)
* [service dependent] describe non-warm-reboot dependency outside systemctl When dependency was described with systemctl, it will kick in all the time, including under warm reboot/restart scenarios. This is not what we always want. For components that are capable of warm reboot/start, they need to describe dependency in service files. Signed-off-by: Ying Xie <ying.xie@microsoft.com> * [service] teamd service should not require swss service Adding require swss will cause teamd to be killed by systemctl when swss stops. This is not what we want in warm reboot. Signed-off-by: Ying Xie <ying.xie@microsoft.com> * refactoring code * rename functions to match other functions in the file
This commit is contained in:
parent
c29e2e28da
commit
a41d9a5d3f
@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=TEAMD container
|
||||
Requires=updategraph.service swss.service
|
||||
Requires=updategraph.service
|
||||
After=updategraph.service swss.service
|
||||
Before=ntp-config.service
|
||||
|
||||
@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait
|
||||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target swss.service
|
||||
WantedBy=multi-user.target
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
SERVICE="swss"
|
||||
PEER="syncd"
|
||||
DEPENDENT="teamd"
|
||||
DEBUGLOG="/tmp/swss-syncd-debug.log"
|
||||
LOCKFILE="/tmp/swss-syncd-lock"
|
||||
|
||||
@ -78,11 +79,24 @@ function clean_up_tables()
|
||||
end" 0
|
||||
}
|
||||
|
||||
startPeerService() {
|
||||
start_peer_and_dependent_services() {
|
||||
check_warm_boot
|
||||
|
||||
if [[ x"$WARM_BOOT" != x"true" ]]; then
|
||||
/bin/systemctl start ${PEER}
|
||||
for dep in ${DEPENDENT}; do
|
||||
/bin/systemctl start ${dep}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
stop_peer_and_dependent_services() {
|
||||
# if warm start enabled or peer lock exists, don't stop peer service docker
|
||||
if [[ x"$WARM_BOOT" != x"true" ]]; then
|
||||
/bin/systemctl stop ${PEER}
|
||||
for dep in ${DEPENDENT}; do
|
||||
/bin/systemctl stop ${dep}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
@ -116,7 +130,7 @@ start() {
|
||||
}
|
||||
|
||||
wait() {
|
||||
startPeerService
|
||||
start_peer_and_dependent_services
|
||||
/usr/bin/${SERVICE}.sh wait
|
||||
}
|
||||
|
||||
@ -135,10 +149,7 @@ stop() {
|
||||
# Unlock has to happen before reaching out to peer service
|
||||
unlock_service_state_change
|
||||
|
||||
# if warm start enabled or peer lock exists, don't stop peer service docker
|
||||
if [[ x"$WARM_BOOT" != x"true" ]]; then
|
||||
/bin/systemctl stop ${PEER}
|
||||
fi
|
||||
stop_peer_and_dependent_services
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
Loading…
Reference in New Issue
Block a user