Merge "Removes Host Cleanup from Container Cleanup Script"

This commit is contained in:
Jenkins 2015-07-23 15:52:56 +00:00 committed by Gerrit Code Review
commit bcf8bca808
2 changed files with 30 additions and 33 deletions

View File

@ -1,35 +1,3 @@
#!/bin/bash #!/bin/bash
# Move to top level directory docker rm $@ $(docker ps -a -q)
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

29
tools/cleanup-host Executable file
View File

@ -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