Also remove the volumes when cleaning up containers

TrivialFix

Change-Id: Ia52451d2c0de09ee9dcf79211389a3b1ce4ae738
This commit is contained in:
Jeffrey Zhang 2016-02-16 22:17:22 +08:00 committed by Éric Lemoine
parent c32aa11256
commit 29833132d8

View File

@ -8,6 +8,7 @@ fi
if [ -n "$1" ]; then if [ -n "$1" ]; then
containers_to_kill=($(docker ps | grep -E "$1" | awk '{print $1}')) containers_to_kill=($(docker ps | grep -E "$1" | awk '{print $1}'))
volumes_to_remove=($(docker volume ls | grep -E "$1" | awk '{print $1}'))
else else
containers_to_kill=( containers_to_kill=(
bootstrap_{ceph_mon,cinder,glance,heat,ironic,ironic_pxe,keystone,magnum,mistral,mongodb,murano,neutron,nova,nova_compute} \ bootstrap_{ceph_mon,cinder,glance,heat,ironic,ironic_pxe,keystone,magnum,mistral,mongodb,murano,neutron,nova,nova_compute} \
@ -35,6 +36,20 @@ else
) )
ceph_osd_bootstrap=$(docker ps -a --filter "name=bootstrap_osd_*" --format "{{.Names}}") ceph_osd_bootstrap=$(docker ps -a --filter "name=bootstrap_osd_*" --format "{{.Names}}")
containers_to_kill="${containers_to_kill} ${ceph_osd_bootstrap}" containers_to_kill="${containers_to_kill} ${ceph_osd_bootstrap}"
volumes_to_remove=(
glance \
ironic-pxe \
mariadb \
openvswitch_db \
neutron_metadata_socket \
nova_{compute,libvirt} \
ceph_mon{,_config} \
rabbitmq \
mongodb \
rsyslog{,_socket} \
haproxy_socket
)
fi fi
echo "Stopping containers..." echo "Stopping containers..."
@ -43,4 +58,7 @@ echo "Stopping containers..."
echo "Removing containers..." echo "Removing containers..."
(docker rm -v -f ${containers_to_kill[@]} 2>&1) > /dev/null (docker rm -v -f ${containers_to_kill[@]} 2>&1) > /dev/null
echo "Removing volumes..."
(docker volume rm ${volumes_to_remove[@]} 2>&1) > /dev/null
echo "All cleaned up!" echo "All cleaned up!"