[fast-reboot] Stop services after killing containers to prevent automatic restart#572
[fast-reboot] Stop services after killing containers to prevent automatic restart#572jleveque merged 1 commit intosonic-net:masterfrom jleveque:fast_reboot_prevent_service_restart_on_kill
Conversation
|
I can see similiar commands in sonic_installer, can you check them as well? |
|
sonic_installer does have calls to |
|
what if the service is going to be restarted before it was stopped? |
|
Retest this please |
|
@pavel-shirshov: If someone or something had called |
|
@jleveque
So I think if we don't fast enough to stop the container, but supervisorctl restarted just killed processes already? |
|
These processes are not set to be restarted by supervisor inside the containers. The restart mechanism uses a supervisor event listener to listen for processes exiting, which then causes supervisor to exit and subsequently the container itself. Then, systemd will restart the entire container. Here we're killing the container, then stopping the systemd service to prevent it from restarting the container. |
|
Retest this please |
1 similar comment
|
Retest this please |
|
@jleveque Got it |
- What I did
Explicitly stop corresponding services after killing Docker containers to prevent the service from automatically restarting the container during fast-/warm-reboot.
We are beginning to configure the services which control Docker containers to automatically restart the service and all dependent services if the container should ever stop. In the case of fast-/warm-reboot, stopping the service could require up to 10 seconds to stop the container (due to the behavior of the underlying
docker stopcommand). This could take too long, so in this script we calldocker kill, which will work faster. However, after killing the container, the service which controls the container (once configured to restart) will restart the container after the specified interval, but we do not want the behavior under these fast-/warm-reboot circumstances. The services will be restarted after completing the reboot. Therefore, we stop the service immediately after killing the corresponding container to ensure the service cannot automatically restart the container.