2015-06-02 06:08:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-03-15 23:58:34 +00:00
|
|
|
# Spawning the neutron agents containers leaves artifacts on the host.
|
2015-06-02 06:08:13 +00:00
|
|
|
# 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
|
|
|
|
|
2016-03-15 23:58:34 +00:00
|
|
|
ip -o link show | awk -F': ' '/tap/{print $2}' | while read -r ifname ; do
|
|
|
|
echo "Removing tap interface $ifname on the host"
|
|
|
|
ip link delete $ifname type veth
|
2015-06-02 06:08:13 +00:00
|
|
|
done
|
|
|
|
|
2016-03-15 23:58:34 +00:00
|
|
|
ip -o link show | awk -F': ' '/brq/{print $2}' | while read -r ifname ; do
|
|
|
|
echo "Removing linux bridge $ifname on the host"
|
|
|
|
ip link delete $ifname type bridge
|
2015-06-02 06:08:13 +00:00
|
|
|
done
|
|
|
|
|
2016-03-15 23:58:34 +00:00
|
|
|
ip -o link show | awk -F': ' '/vxlan/{print $2}' | while read -r ifname ; do
|
|
|
|
echo "Removing vxlan interface $ifname on the host"
|
|
|
|
ip link delete $ifname type vxlan
|
2015-06-02 06:08:13 +00:00
|
|
|
done
|
2016-03-28 18:09:23 +00:00
|
|
|
|
2016-09-01 06:13:59 +00:00
|
|
|
# Keepalived leaves VIP on the host in case of accidental removal.
|
|
|
|
# This snippet removes VIPs.
|
|
|
|
if [[ "$enable_haproxy" == "yes" ]]; then
|
|
|
|
ip -o addr list | awk '{print $2,$4}' | cut -d/ -f1 | while read -r ifname ifaddr ; do
|
|
|
|
if [[ "$kolla_internal_vip_address" == "$ifaddr" ||
|
|
|
|
"$kolla_external_vip_address" == "$ifaddr" ]]; then
|
|
|
|
echo "Removing VIP $ifaddr on the host"
|
|
|
|
ip addr delete dev $ifname $ifaddr
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2016-03-28 18:09:23 +00:00
|
|
|
echo "Creating a fstab backup..."
|
|
|
|
sudo cp /etc/fstab /etc/fstab_backup
|
|
|
|
|
2017-04-14 02:16:45 +00:00
|
|
|
if [[ "$enable_swift" == "yes" ]]; then
|
|
|
|
echo "Removing swift references from fstab..."
|
|
|
|
cat /etc/fstab | grep "/srv/node/d*" | xargs umount
|
|
|
|
sed -i '/\/srv\/node\//d' /etc/fstab
|
|
|
|
fi
|
|
|
|
|
2017-03-31 08:17:40 +00:00
|
|
|
if [[ "$glance_file_datadir_volume" != "glance" && -d "$glance_file_datadir_volume" ]]; then
|
|
|
|
echo "Removing glance volume if it is customzied"
|
|
|
|
rm -rfv $glance_file_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2018-07-05 02:16:59 +00:00
|
|
|
if [[ "$nova_instance_datadir_volume" != "nova_compute" && -d "$nova_instance_datadir_volume" ]]; then
|
|
|
|
echo "Removing nova_compute volume if it is customzied"
|
|
|
|
rm -rfv $nova_instance_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2019-02-25 14:53:08 +00:00
|
|
|
if [[ "$elasticsearch_datadir_volume" != "elasticsearch" && -d "$elasticsearch_datadir_volume" ]]; then
|
|
|
|
echo "Removing elasticsearch volume if it is customzied"
|
|
|
|
rm -rfv $elasticsearch_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2019-01-02 03:42:00 +00:00
|
|
|
if [[ "$gnocchi_metric_datadir_volume" != "gnocchi" && -d "$gnocchi_metric_datadir_volume" ]]; then
|
|
|
|
echo "Removing gnocchi volume if it is customzied"
|
|
|
|
rm -rfv $gnocchi_metric_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2020-02-14 15:24:06 +00:00
|
|
|
if [[ "$influxdb_datadir_volume" != "influxdb" && -d "$influxdb_datadir_volume" ]]; then
|
|
|
|
echo "Removing influxdb volume if it is customzied"
|
|
|
|
rm -rfv $influxdb_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2020-03-26 20:42:58 +00:00
|
|
|
if [[ "$kafka_datadir_volume" != "kafka" && -d "$kafka_datadir_volume" ]]; then
|
|
|
|
echo "Removing kafka volume if it is customised"
|
|
|
|
rm -rfv $kafka_datadir_volume
|
|
|
|
fi
|
|
|
|
|
2016-04-07 20:13:46 +00:00
|
|
|
FOLDER_PATH="/etc/kolla/"
|
2017-04-06 13:21:09 +00:00
|
|
|
|
|
|
|
if [[ -e "$FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.sh" ]]; then
|
|
|
|
echo uninstalling ovs-dpdk service files and tools.
|
|
|
|
sudo CONFIG_FILE="$FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.conf" $FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.sh uninstall
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Getting folders name..."
|
2016-04-07 20:13:46 +00:00
|
|
|
for dir in $FOLDER_PATH*; do
|
|
|
|
if [ "$dir" == "$FOLDER_PATH""passwords.yml" ] || \
|
|
|
|
[ "$dir" == "$FOLDER_PATH""globals.yml" ] || \
|
2016-04-12 10:59:43 +00:00
|
|
|
[ "$dir" == "$FOLDER_PATH""kolla-build.conf" ] || \
|
2018-06-07 20:44:24 +00:00
|
|
|
[ "$dir" == "$FOLDER_PATH""config" ] || \
|
|
|
|
[ "$dir" == "$FOLDER_PATH""kolla-cli" ] || \
|
|
|
|
[ "$dir" == "$FOLDER_PATH""certificates" ]; then
|
2016-04-07 20:13:46 +00:00
|
|
|
echo "Skipping:" $dir
|
|
|
|
else
|
|
|
|
rm -rfv $dir
|
|
|
|
fi
|
|
|
|
done
|
2017-04-07 11:53:24 +00:00
|
|
|
|
|
|
|
if [[ "$destroy_include_dev" == "yes" ]]; then
|
|
|
|
echo "Cleaning up dev repos..."
|
|
|
|
rm -rfv "${kolla_dev_repos_directory}"
|
|
|
|
fi
|