aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-08 12:00:09 +0000
committerGerrit Code Review <review@openstack.org>2016-09-08 12:00:09 +0000
commit4a1e761e306fe8a08e5e06914f2ed5e21d377419 (patch)
tree63cf82ddd5691e9df063bb73195f9ccd4943cb80
parentb10e29281ad81a16e340641cf144a9540e94b9d2 (diff)
parentb6de8fdc0604b72b28ec5236819ce82c89759605 (diff)
downloadkolla-4a1e761e306fe8a08e5e06914f2ed5e21d377419.tar.gz
kolla-4a1e761e306fe8a08e5e06914f2ed5e21d377419.zip
Merge "Keepalived leaves VIP on the host in case of accidental removal."
-rw-r--r--ansible/roles/destroy/tasks/cleanup_host.yml6
-rwxr-xr-xtools/cleanup-host12
2 files changed, 17 insertions, 1 deletions
diff --git a/ansible/roles/destroy/tasks/cleanup_host.yml b/ansible/roles/destroy/tasks/cleanup_host.yml
index 9429eba6b..228fb70bb 100644
--- a/ansible/roles/destroy/tasks/cleanup_host.yml
+++ b/ansible/roles/destroy/tasks/cleanup_host.yml
@@ -1,6 +1,10 @@
---
- name: Destroying Kolla host configuration
- command: /tmp/kolla-cleanup/tools/cleanup-host
+ command: >
+ env enable_haproxy={{ enable_haproxy }}
+ kolla_internal_vip_address={{ kolla_internal_vip_address }}
+ kolla_external_vip_address={{ kolla_external_vip_address }}
+ /tmp/kolla-cleanup/tools/cleanup-host
- name: Destroying kolla-cleanup folder
file:
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