kolla-ansible/tools/stop-containers
Borne Mace 2cfc069e21 Added support for a stop playbook in kolla
Behavior of stop playbook is very similar to the destroy
playbook.  This is meant when you may just want to bring down
the service for some sort of maintenance but not destroy all
the associated data. Also added support for the new playbook
into the kolla-ansible command.

Change-Id: Icf0ca91de71dc8ead3a024de3e5b9e49116560d1
Implements: blueprint ansible-stop-host-playbook
2016-11-23 11:45:23 +00:00

19 lines
569 B
Bash
Executable File

#!/bin/bash
if [[ $(pgrep qemu) ]]; then
echo "Some qemu processes were detected."
echo "Docker will not be able to stop the nova_libvirt container with those running."
echo "Please clean them up before rerunning this script."
exit 1
fi
if [ -n "$1" ]; then
containers_to_stop=($(docker ps | grep -E "$1" | awk '{print $1}'))
else
containers_to_stop=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a)
fi
echo "Stopping containers..."
(docker stop -t 30 ${containers_to_stop} 2>&1) > /dev/null
echo "All containers stopped!"