diff options
| author | Eduardo Gonzalez <dabarren@gmail.com> | 2016-11-13 16:15:08 +0000 |
|---|---|---|
| committer | Eduardo Gonzalez <dabarren@gmail.com> | 2016-12-30 14:10:30 +0100 |
| commit | da83802b1b01eb442a551c19eddef063751d008b (patch) | |
| tree | e5ea9f6fbffad57a07623be5ae0eb0d576f49e2f | |
| parent | 57ee8b3751955380934e89c041296f6bd6f75a49 (diff) | |
| download | kolla-ansible-da83802b1b01eb442a551c19eddef063751d008b.tar.gz kolla-ansible-da83802b1b01eb442a551c19eddef063751d008b.zip | |
Fix ovs-cleanup issue at cleanup scripts
Move ovs-cleanup step to cleanup-containers,
otherwise bridges will not be removed because neutron_openvswitch_agent
container does not exists after running cleanup-containers.
Add logic to cleanup ovs bridges only when openvswitch_db
is removed and openvswitch-agent is running,
so when removing other container from a parameter at script
invocation ovs-cleanup will not be executed.
Change-Id: Ie5fea40426df0e9e465fc173aba185f61098f676
Closes-Bug: #1640178
| -rwxr-xr-x | tools/cleanup-containers | 14 | ||||
| -rwxr-xr-x | tools/cleanup-host | 5 |
2 files changed, 12 insertions, 7 deletions
diff --git a/tools/cleanup-containers b/tools/cleanup-containers index a07c1d4d1..099e5b234 100755 --- a/tools/cleanup-containers +++ b/tools/cleanup-containers @@ -8,8 +8,9 @@ if [[ $COMPUTE ]] && [[ $QEMU_PIDS ]] && [[ $(ps --no-headers wwwup $QEMU_PIDS | 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}')) + containers_to_kill=($(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a | grep -E "$1" | awk '{print $1}')) + volumes_to_remove=($(docker inspect -f '{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' $1 | \ + egrep -v '(^\s*$)' | sort | uniq)) else containers_to_kill=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a) @@ -17,6 +18,15 @@ 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 \ + --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \ + --ovs_all_ports) > /dev/null +fi + echo "Stopping containers..." (docker stop -t 2 ${containers_to_kill} 2>&1) > /dev/null diff --git a/tools/cleanup-host b/tools/cleanup-host index 59d463b22..c319ce0b8 100755 --- a/tools/cleanup-host +++ b/tools/cleanup-host @@ -27,11 +27,6 @@ ip -o link show | awk -F': ' '/vxlan/{print $2}' | while read -r ifname ; do ip link delete $ifname type vxlan done -echo "Removing ovs bridge..." -(docker exec -u root neutron_openvswitch_agent neutron-ovs-cleanup \ - --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini \ - --ovs_all_ports) > /dev/null - # Keepalived leaves VIP on the host in case of accidental removal. # This snippet removes VIPs. if [[ "$enable_haproxy" == "yes" ]]; then |
