From 85c99e8734cebbd3950242817a93ed1f4c77b52b Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 26 May 2020 11:57:26 +0200 Subject: [PATCH] Fix sending SIGTERM to the sidecar containers This is "repeat" of the Nate's fix done for stable/train branch in [1]. This patch had got one issue - it missed passing "15" signal to the signal_container() function and due to that e.g. keepalived sidecar container wasn't never killed when router was deleted. Patch [1] was recently removed with patch [2] so now I need to get it back in the kill-script. New version of the kill-script is in tripleo-ansible in the tripleo-systemd-wrapper role where all is done fine and "15" signal is passed properly to the signal_container() function. [1] https://review.opendev.org/#/c/704463/ [2] https://review.opendev.org/#/c/724843/ Change-Id: I3f18922cf58bf8359f27aebf295bdb131bf2333a Closes-bz: #1839071 (cherry picked from commit e3331ea725d54e45bf6d683f4b56eb876b733995) --- deployment/neutron/kill-script | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/deployment/neutron/kill-script b/deployment/neutron/kill-script index fe1147131b..c2ab55298b 100644 --- a/deployment/neutron/kill-script +++ b/deployment/neutron/kill-script @@ -40,9 +40,13 @@ kill_container() { $CLI rm $2 } -hup_container() { - add_date "Sending HUP signal to $1 ($2)" - $CLI kill --signal HUP $2 +signal_container() { + SIGNAL=$3 + if [ -z "$SIGNAL" ]; then + SIGNAL="HUP" + fi + add_date "Sending signal '$SIGNAL' to $1 ($2)" + $CLI kill --signal $SIGNAL $2 } {% raw -%} @@ -53,13 +57,16 @@ if [ -f /proc/$PID/cgroup ]; then case $SIG in HUP) - hup_container $CT_NAME $CT_ID + signal_container $CT_NAME $CT_ID ;; 9) kill_container $CT_NAME $CT_ID ;; + 15) + signal_container $CT_NAME $CT_ID 15 + ;; *) - add_date "Unknown action ${SIG} for ${$CT_NAME} ${CT_ID}" + add_date "Unknown action ${SIG} for ${CT_NAME} ${CT_ID}" exit 1 ;; esac