From f750a6fedbb34399e1ee4dd540c13028d53c0e13 Mon Sep 17 00:00:00 2001 From: Attila Fazekas Date: Wed, 1 Jul 2015 12:17:35 +0200 Subject: [PATCH] Already dead process tolerance in unstack.sh The gate/updown.sh calls the unstack.sh with -ex option. Normally we do not use -e with unstack.sh. The unstack.sh can fail if the service already stopped, and it also can have flaky failures on the gate. For example the stop_swift function tries to kill swift in two different ways, and if the first one succeeds before the 2th attempt the pkill fails the whole unstack.sh. This change accepts kill failure. Normally the kill can fail if the process does not exits, or when you do not have permission to the kill operation. Since the permission issue is very unlikely in our case, this change does not tries to distinguish the two operation. The behavior of the unstack.sh wen you are not using -ex should not be changed by this change. Change-Id: I64bf3cbe1b60c96f5b271dcfb620c3d4b50de26b --- functions-common | 2 +- lib/neutron_plugins/services/loadbalancer | 2 +- lib/swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions-common b/functions-common index 6ab567a4c6..f122e56f98 100644 --- a/functions-common +++ b/functions-common @@ -1342,7 +1342,7 @@ function screen_stop_service { if is_service_enabled $service; then # Clean up the screen window - screen -S $SCREEN_NAME -p $service -X kill + screen -S $SCREEN_NAME -p $service -X kill || true fi } diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer index f465cc94b4..34190f9a56 100644 --- a/lib/neutron_plugins/services/loadbalancer +++ b/lib/neutron_plugins/services/loadbalancer @@ -42,7 +42,7 @@ function neutron_agent_lbaas_configure_agent { function neutron_lbaas_stop { pids=$(ps aux | awk '/haproxy/ { print $2 }') - [ ! -z "$pids" ] && sudo kill $pids + [ ! -z "$pids" ] && sudo kill $pids || true } # Restore xtrace diff --git a/lib/swift b/lib/swift index 0cd51aaddf..5b73981ed2 100644 --- a/lib/swift +++ b/lib/swift @@ -772,7 +772,7 @@ function stop_swift { stop_process s-${type} done # Blast out any stragglers - pkill -f swift- + pkill -f swift- || true } function swift_configure_tempurls {