diff options
| author | Daneyon Hansen <danehans@cisco.com> | 2015-06-02 15:08:13 +0900 |
|---|---|---|
| committer | Swapnil Kulkarni <me@coolsvap.net> | 2015-07-23 04:24:05 +0000 |
| commit | 171a64bcd8deaee2ddfa59688b5c886cafd8a857 (patch) | |
| tree | bab5d3c9d7df56d38d0e1bc796f89a8afe21b4dd | |
| parent | 6d4a55060e13723138facd90dc9786e7f2c3684b (diff) | |
| download | kolla-171a64bcd8deaee2ddfa59688b5c886cafd8a857.tar.gz kolla-171a64bcd8deaee2ddfa59688b5c886cafd8a857.zip | |
Removes Host Cleanup from Container Cleanup Script
Split the content of cleanup-containers into containers cleanup and host
cleanup. This allows to run the cleanup-containers from OSX clients,
while keeping needed code to delete host artifacts left behind by the
neutron agents container.
In addition, cleanup-containers may disappear in the future, replaced by
a docker-compose wrapper.
Co-Authored-By: Martin André <martin.andre@kvhasia.com>
Co-Authored-By: Swapnil Kulkarni <me@coolsvap.net>
Change-Id: I3aa731e7e0f9eb3dad9c363bb5d4a575d84a2fae
Closes-Bug: #1477383
| -rwxr-xr-x | tools/cleanup-containers | 34 | ||||
| -rwxr-xr-x | tools/cleanup-host | 29 |
2 files changed, 30 insertions, 33 deletions
diff --git a/tools/cleanup-containers b/tools/cleanup-containers index 4812f5744..7b0e8341e 100755 --- a/tools/cleanup-containers +++ b/tools/cleanup-containers @@ -1,35 +1,3 @@ #!/bin/bash -# Move to top level directory -REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") -cd "$(dirname "$REAL_PATH")/.." - -. tools/validate-docker-execute - -# Remove docker containers -docker ps -a -q | while read -r line ; do - echo "Removing docker containers" - docker rm -f $line -done - -# Spawning the neutron-agents container leaves artifacts on the host. -# This script removes these artifacts. -ip netns list | while read -r line ; do - echo "Removing network namespaces on the host" - ip netns delete $line -done - -ifconfig | grep tap | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do - echo "Removing tap interfaces on the host" - ip link delete $line type veth -done - -ifconfig | grep brq | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do - echo "Removing linux bridges on the host" - ip link delete $line type bridge -done - -ifconfig | grep vxlan | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do - echo "Removing vxlan interfaces on the host" - ip link delete $line type vxlan -done +docker rm $@ $(docker ps -a -q) diff --git a/tools/cleanup-host b/tools/cleanup-host new file mode 100755 index 000000000..c38dace43 --- /dev/null +++ b/tools/cleanup-host @@ -0,0 +1,29 @@ +#!/bin/bash + +. tools/validate-docker-execute + +# Move to top level directory +REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") +cd "$(dirname "$REAL_PATH")/.." + +# Spawning the neutron-agents container leaves artifacts on the host. +# This script removes these artifacts. +ip netns list | while read -r line ; do + echo "Removing network namespace $line on the host" + ip netns delete $line +done + +ifconfig | grep tap | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do + echo "Removing tap interface $line on the host" + ip link delete $line type veth +done + +ifconfig | grep brq | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do + echo "Removing linux bridge $line on the host" + ip link delete $line type bridge +done + +ifconfig | grep vxlan | awk '{print $1;}'| cut -f1 -d':' | while read -r line ; do + echo "Removing vxlan interface $line on the host" + ip link delete $line type vxlan +done |
