From 9c1f876e49a5b46245bf66b6159468ad6a475776 Mon Sep 17 00:00:00 2001 From: Vikas Choudhary Date: Wed, 26 Oct 2016 16:17:05 +0530 Subject: [PATCH] DevStack fails if docker service already running Existing docker pid file should be deleted before starting docker service. Change-Id: If2c173aee98fbdaa5681e3e4fccc02fa155a01fa Closes-bug: #1636780 --- devstack/plugin.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 178d9bd5a..e69434d68 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -134,16 +134,6 @@ function run_etcd { function prepare_docker { curl -L http://get.docker.com | sudo bash - - # After an ./unstack it will be stopped. So it is OK if it returns - # exit-code == 1 - stop_service docker || true - - # Make sure there's no leftover Docker process and pidfile - local DOCKER_PIDFILE=/var/run/docker.pid - if [ -f "$DOCKER_PIDFILE" ]; then - sudo kill -s SIGTERM "$(cat $DOCKER_PIDFILE)" - fi } function run_docker { @@ -167,7 +157,11 @@ function stop_docker { # Stop process does not handle well Docker 1.12+ new multi process # split and doesn't kill them all. Let's leverage Docker's own pidfile - sudo kill -s SIGTERM "$(cat /var/run/docker.pid)" + local DOCKER_PIDFILE="/var/run/docker.pid" + if [ -f "$DOCKER_PIDFILE" ]; then + echo "Killing docker" + sudo kill -s SIGTERM "$(cat "$DOCKER_PIDFILE")" + fi } function prepare_kubernetes_files { @@ -310,6 +304,7 @@ if is_service_enabled kuryr-kubernetes; then if is_service_enabled docker; then check_docker || prepare_docker + stop_docker run_docker fi