DevStack fails if docker service already running

Existing docker pid file should be deleted before starting docker
service.

Change-Id: If2c173aee98fbdaa5681e3e4fccc02fa155a01fa
Closes-bug: #1636780
This commit is contained in:
Vikas Choudhary 2016-10-26 16:17:05 +05:30 committed by Antoni Segura Puimedon
parent 09c272bd37
commit 9c1f876e49
No known key found for this signature in database
GPG Key ID: 2329618D2967720A
1 changed files with 6 additions and 11 deletions

View File

@ -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