2014-10-17 12:40:31 +00:00
|
|
|
#!/bin/bash
|
2015-08-27 13:24:43 +00:00
|
|
|
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
|
2015-08-31 04:14:17 +00:00
|
|
|
fi
|
2015-08-27 13:24:43 +00:00
|
|
|
|
2015-12-02 22:54:52 +00:00
|
|
|
if [ -n "$1" ]; then
|
|
|
|
containers_to_kill=($(docker ps | grep -E "$1" | awk '{print $1}'))
|
2016-02-16 14:17:22 +00:00
|
|
|
volumes_to_remove=($(docker volume ls | grep -E "$1" | awk '{print $1}'))
|
2015-12-02 22:54:52 +00:00
|
|
|
else
|
|
|
|
containers_to_kill=(
|
2016-03-28 16:58:50 +00:00
|
|
|
bootstrap_{ceph_mon,cinder,glance,heat,heka,ironic,ironic_pxe,keystone,magnum,mariadb,mistral,mongodb,murano,neutron,nova,nova_compute} \
|
2016-01-20 04:02:10 +00:00
|
|
|
cinder_{volume,scheduler,backup,api} \
|
2016-02-19 18:11:20 +00:00
|
|
|
ceph_{mon,rgw} \
|
2016-03-04 11:01:55 +00:00
|
|
|
cron \
|
2016-03-03 07:13:17 +00:00
|
|
|
elasticsearch \
|
2016-01-20 04:02:10 +00:00
|
|
|
glance_{api,registry} \
|
2015-12-02 22:54:52 +00:00
|
|
|
haproxy \
|
|
|
|
heat_{api{,_cfn},engine} \
|
2016-03-03 07:13:17 +00:00
|
|
|
heka \
|
2015-12-02 22:54:52 +00:00
|
|
|
horizon \
|
2016-02-16 12:31:39 +00:00
|
|
|
ironic_{inspector,conductor,api,pxe} \
|
2016-01-20 04:02:10 +00:00
|
|
|
keepalived \
|
2015-12-02 22:54:52 +00:00
|
|
|
keystone \
|
2016-03-03 07:13:17 +00:00
|
|
|
kibana \
|
2016-01-29 16:40:54 +00:00
|
|
|
kolla_toolbox \
|
2015-12-02 22:54:52 +00:00
|
|
|
magnum_{api,conductor} \
|
2016-01-28 14:00:43 +00:00
|
|
|
manila_{api,share,scheduler} \
|
2016-01-20 04:02:10 +00:00
|
|
|
mariadb \
|
|
|
|
memcached \
|
2016-02-14 12:04:13 +00:00
|
|
|
mistral_{api,engine,executor} \
|
2016-04-07 20:20:05 +00:00
|
|
|
mongodb \
|
2015-12-02 22:54:52 +00:00
|
|
|
murano_{api,engine} \
|
2016-02-09 05:48:23 +00:00
|
|
|
neutron_{server,dhcp_agent,l3_agent,linuxbridge_agent,metadata_agent,openvswitch_agent} \
|
2016-04-04 20:02:46 +00:00
|
|
|
nova_{scheduler,novncproxy,consoleauth,conductor,api,compute,libvirt,spicehtml5proxy,compute_ironic,ssh} \
|
2016-01-20 04:02:10 +00:00
|
|
|
openvswitch_{vswitchd,db} \
|
2016-02-14 12:04:13 +00:00
|
|
|
rabbitmq{,_bootstrap} \
|
2016-03-03 07:13:17 +00:00
|
|
|
swift_{account_{auditor,reaper,replicator,server},container_{auditor,replicator,server,updater},object_{auditor,expirer,replicator,server,updater},proxy_server,rsyncd}
|
2015-12-02 22:54:52 +00:00
|
|
|
)
|
2016-02-14 12:04:13 +00:00
|
|
|
ceph_osd_bootstrap=$(docker ps -a --filter "name=bootstrap_osd_*" --format "{{.Names}}")
|
2016-02-19 18:11:20 +00:00
|
|
|
ceph_osd_containers=$(docker ps -a --filter "name=ceph_osd_*" --format "{{.Names}}")
|
|
|
|
containers_to_kill="${containers_to_kill} ${ceph_osd_containers} ${ceph_osd_bootstrap}"
|
2016-02-16 14:17:22 +00:00
|
|
|
|
|
|
|
volumes_to_remove=(
|
2016-03-03 07:13:17 +00:00
|
|
|
ceph_mon{,_config} \
|
|
|
|
elasticsearch \
|
2016-02-16 14:17:22 +00:00
|
|
|
glance \
|
2016-03-03 07:13:17 +00:00
|
|
|
haproxy_socket \
|
|
|
|
heka{,_socket} \
|
2016-02-16 09:00:59 +00:00
|
|
|
ironic_pxe \
|
2016-03-03 07:13:17 +00:00
|
|
|
kolla_logs \
|
2016-03-15 19:37:17 +00:00
|
|
|
libvirtd \
|
2016-02-16 14:17:22 +00:00
|
|
|
mariadb \
|
2016-03-03 07:13:17 +00:00
|
|
|
mongodb \
|
2016-02-16 14:17:22 +00:00
|
|
|
neutron_metadata_socket \
|
2016-03-15 19:37:17 +00:00
|
|
|
nova_compute \
|
2016-03-03 07:13:17 +00:00
|
|
|
openvswitch_db \
|
|
|
|
rabbitmq
|
2016-02-16 14:17:22 +00:00
|
|
|
)
|
2015-12-02 22:54:52 +00:00
|
|
|
fi
|
2015-08-27 13:24:43 +00:00
|
|
|
|
|
|
|
echo "Stopping containers..."
|
2015-10-06 03:07:43 +00:00
|
|
|
(docker stop -t 2 ${containers_to_kill[@]} 2>&1) > /dev/null
|
2015-08-27 13:24:43 +00:00
|
|
|
|
|
|
|
echo "Removing containers..."
|
2015-10-06 03:07:43 +00:00
|
|
|
(docker rm -v -f ${containers_to_kill[@]} 2>&1) > /dev/null
|
2015-08-27 13:24:43 +00:00
|
|
|
|
2016-02-16 14:17:22 +00:00
|
|
|
echo "Removing volumes..."
|
|
|
|
(docker volume rm ${volumes_to_remove[@]} 2>&1) > /dev/null
|
|
|
|
|
2015-08-27 13:24:43 +00:00
|
|
|
echo "All cleaned up!"
|