From 29833132d8f1df678f1e9ad7348e27311e3f5a3c Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Tue, 16 Feb 2016 22:17:22 +0800 Subject: [PATCH] Also remove the volumes when cleaning up containers TrivialFix Change-Id: Ia52451d2c0de09ee9dcf79211389a3b1ce4ae738 --- tools/cleanup-containers | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/cleanup-containers b/tools/cleanup-containers index 962a612510..cb3b2a7333 100755 --- a/tools/cleanup-containers +++ b/tools/cleanup-containers @@ -8,6 +8,7 @@ fi if [ -n "$1" ]; then containers_to_kill=($(docker ps | grep -E "$1" | awk '{print $1}')) + volumes_to_remove=($(docker volume ls | grep -E "$1" | awk '{print $1}')) else containers_to_kill=( 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}}") 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 echo "Stopping containers..." @@ -43,4 +58,7 @@ echo "Stopping containers..." echo "Removing containers..." (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!"