aboutsummaryrefslogtreecommitdiff
path: root/tools/cleanup-host
diff options
context:
space:
mode:
authorTakashi Sogabe <tasogabe@yahoo-corp.jp>2016-09-01 15:13:59 +0900
committerTakashi Sogabe <tasogabe@yahoo-corp.jp>2016-09-07 17:13:58 +0900
commitb6de8fdc0604b72b28ec5236819ce82c89759605 (patch)
treea5e986c663c422f6d5fc9866627d67bbbc1113ac /tools/cleanup-host
parent69af20852ad2b53dfcf76b9132a378c4f6c5a8c9 (diff)
downloadkolla-ansible-b6de8fdc0604b72b28ec5236819ce82c89759605.tar.gz
kolla-ansible-b6de8fdc0604b72b28ec5236819ce82c89759605.zip
Keepalived leaves VIP on the host in case of accidental removal.
This patch removes VIPs when 'kolla-ansible destroy' is invoked. Change-Id: I263b9bc852c7bc3448a6a15b3115b1f226071afc Closes-Bug: #1605442
Diffstat (limited to 'tools/cleanup-host')
-rwxr-xr-xtools/cleanup-host12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/cleanup-host b/tools/cleanup-host
index 909bed830..c50a3a287 100755
--- a/tools/cleanup-host
+++ b/tools/cleanup-host
@@ -27,6 +27,18 @@ ip -o link show | awk -F': ' '/vxlan/{print $2}' | while read -r ifname ; do
ip link delete $ifname type vxlan
done
+# 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
+
echo "Creating a fstab backup..."
sudo cp /etc/fstab /etc/fstab_backup