kolla-ansible/tools/cleanup-host
Daneyon Hansen 171a64bcd8 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
2015-07-23 04:24:05 +00:00

30 lines
941 B
Bash
Executable File

#!/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