Merge "Fix cleanup-containers script"

This commit is contained in:
Jenkins 2017-01-25 16:53:44 +00:00 committed by Gerrit Code Review
commit f9fa774498
2 changed files with 5 additions and 11 deletions

View File

@ -1,10 +1,3 @@
---
- name: Destroying all Kolla containers and volumes on compute node
environment:
COMPUTE: true
- name: Destroying all Kolla containers and volumes
command: /tmp/kolla-cleanup/tools/cleanup-containers
when: inventory_hostname in groups['compute']
- name: Destroying all Kolla containers and volumes on non compute node
command: /tmp/kolla-cleanup/tools/cleanup-containers
when: inventory_hostname not in groups['compute']

View File

@ -1,6 +1,9 @@
#!/bin/bash
containers_running=$(docker ps --filter "label=kolla_version" --format "{{.Names}}")
QEMU_PIDS=$(pgrep -l qemu | awk '!/qemu-ga/ {print $1}')
if [[ $COMPUTE ]] && [[ $QEMU_PIDS ]] && [[ $(ps --no-headers wwwup $QEMU_PIDS | grep --invert-match '\-xen\-domid 0') ]]; then
if [[ "${containers_running}" =~ "nova_libvirt" ]] && [[ $QEMU_PIDS ]] && [[ $(ps --no-headers wwwup $QEMU_PIDS | grep --invert-match '\-xen\-domid 0') ]]; 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."
@ -18,8 +21,6 @@ else
egrep -v '(^\s*$)' | sort | uniq)
fi
containers_running=$(docker ps --filter "label=kolla_version" --format "{{.Names}}")
if [[ "${containers_to_kill}" =~ "openvswitch_vswitchd" ]] && [[ "${containers_running}" =~ "neutron_openvswitch_agent" ]]; then
echo "Removing ovs bridge..."
(docker exec -u root neutron_openvswitch_agent neutron-ovs-cleanup \