[openstack-tripleo-image-elements] Use keepalived notify script if virtual_interfaces are defined

slagle slagle at fedoraproject.org
Tue Dec 16 11:11:18 UTC 2014


commit f4c4a87307ff17c8e6925e9386bd5061cdb9d69f
Author: James Slagle <jslagle at redhat.com>
Date:   Tue Dec 16 06:10:58 2014 -0500

    Use keepalived notify script if virtual_interfaces are defined
    
    Changelog:
    - Use keepalived notify script if virtual_interfaces are defined
    - Set explicit route for VIPs
    - Wait for tuskar-api to start up

 0014-Wait-for-tuskar-api-to-start-up.patch         |   34 +++++++++
 0015-Set-explicit-route-for-VIPs.patch             |   77 ++++++++++++++++++++
 openstack-tripleo-image-elements.spec              |   13 +++-
 3 files changed, 123 insertions(+), 1 deletions(-)
---
diff --git a/0014-Wait-for-tuskar-api-to-start-up.patch b/0014-Wait-for-tuskar-api-to-start-up.patch
new file mode 100644
index 0000000..2947b72
--- /dev/null
+++ b/0014-Wait-for-tuskar-api-to-start-up.patch
@@ -0,0 +1,34 @@
+From 29a3d296f256fbb32d12e446f0d2aaeec61597ab Mon Sep 17 00:00:00 2001
+From: Richard Su <rwsu at redhat.com>
+Date: Wed, 19 Nov 2014 17:49:14 -0800
+Subject: [PATCH] Wait for tuskar-api to start up
+
+tuskar-ui runs immediately after tuskar-api. There is a chance
+that the api has not come up completely before 101-tuskar-ui runs.
+This patch adds a five second wait if tuskar-api is found to be
+not running.
+
+Change-Id: I5c9ff917d7f24b704e17d336cc1f79d211abd0a9
+Closes-Bug: 1394430
+---
+ .../tuskar-ui/os-refresh-config/post-configure.d/101-tuskar-ui     | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/elements/tuskar-ui/os-refresh-config/post-configure.d/101-tuskar-ui b/elements/tuskar-ui/os-refresh-config/post-configure.d/101-tuskar-ui
+index dae696e..025b419 100755
+--- a/elements/tuskar-ui/os-refresh-config/post-configure.d/101-tuskar-ui
++++ b/elements/tuskar-ui/os-refresh-config/post-configure.d/101-tuskar-ui
+@@ -17,6 +17,13 @@ fi
+ 
+ source /root/stackrc
+ 
++# Test tuskar-api and wait for it to start up
++export TUSKAR_API_TEST=$(curl localhost:8585)
++if [ ! -n "$TUSKAR_API_TEST" ]; then
++    echo "Waiting 5 second for tuskar-api to start";
++    sleep 5;
++fi
++
+ if [ -z "$(tuskar --tuskar-api-version 2 plan-list | grep overcloud)" ]; then
+     COMPUTE_IMAGE_ID=$( glance image-show overcloud-compute | grep id | awk '$2=="id" {print $4}' )
+     CONTROL_IMAGE_ID=$( glance image-show overcloud-control | grep id | awk '$2=="id" {print $4}' )
diff --git a/0015-Set-explicit-route-for-VIPs.patch b/0015-Set-explicit-route-for-VIPs.patch
new file mode 100644
index 0000000..f3cdd63
--- /dev/null
+++ b/0015-Set-explicit-route-for-VIPs.patch
@@ -0,0 +1,77 @@
+From a7939578d2e8446264a36c197c9600de1279ff97 Mon Sep 17 00:00:00 2001
+From: Jan Provaznik <jprovazn at redhat.com>
+Date: Wed, 19 Nov 2014 15:24:46 +0100
+Subject: [PATCH] Set explicit route for VIPs
+
+When VIPs are moved around explicit route for each VIP is
+set to make sure that connections opened from local node to VIP
+don't use VIP as source address - if VIP is used as source address
+and is moved away then connections are stalled.
+
+This explicit routes are removed when VIPs are moved to another node.
+
+Closes-Bug: 1376200
+Change-Id: Ie5d55fbe33231519015b313b1f9210ac3614266e
+---
+ elements/keepalived/bin/keepalived_vip_change.sh   | 30 ++++++++++++++++++++++
+ .../os-apply-config/etc/keepalived/keepalived.conf |  1 +
+ .../os-apply-config/etc/keepalived/virtual_ips     |  3 +++
+ 3 files changed, 34 insertions(+)
+ create mode 100755 elements/keepalived/bin/keepalived_vip_change.sh
+ create mode 100644 elements/keepalived/os-apply-config/etc/keepalived/virtual_ips
+
+diff --git a/elements/keepalived/bin/keepalived_vip_change.sh b/elements/keepalived/bin/keepalived_vip_change.sh
+new file mode 100755
+index 0000000..a0fd8b4
+--- /dev/null
++++ b/elements/keepalived/bin/keepalived_vip_change.sh
+@@ -0,0 +1,30 @@
++#!/bin/bash
++
++# A simple script triggered by keepalived when VIPs are moved
++# around. When VIPs are moved to this node, explicit route for
++# each VIP is added - this assures that any connection to VIP
++# will use by default local-ipv4 as source address. Without this
++# explicit route VIP address is used which causes issues when VIP
++# moved to another node.
++# https://bugs.launchpad.net/tripleo/+bug/1376200
++#
++# When VIP is moved from this node, this explicit route is removed
++# to allow proper routing from this node to new VIP node.
++
++set -eu
++
++logger "Started $0 $@"
++PATH="$PATH:/bin:/sbin"
++LOCAL_IP=$(os-apply-config --key local-ipv4 --type netaddress)
++
++if [ "$3" = "MASTER" ]; then
++    for ip in $(cat /etc/keepalived/virtual_ips); do
++        logger "adding explicit route for $ip"
++        ip ro replace local $ip dev lo src $LOCAL_IP
++    done
++else
++    for ip in $(cat /etc/keepalived/virtual_ips); do
++        logger "removing explicit route for $ip"
++        ip ro del local $ip
++    done
++fi
+diff --git a/elements/keepalived/os-apply-config/etc/keepalived/keepalived.conf b/elements/keepalived/os-apply-config/etc/keepalived/keepalived.conf
+index 75e415d..1cc527c 100644
+--- a/elements/keepalived/os-apply-config/etc/keepalived/keepalived.conf
++++ b/elements/keepalived/os-apply-config/etc/keepalived/keepalived.conf
+@@ -25,4 +25,5 @@ vrrp_instance VI_1 {
+       track_script {
+            chk_haproxy
+       }
++      notify /usr/local/bin/keepalived_vip_change.sh
+ }
+diff --git a/elements/keepalived/os-apply-config/etc/keepalived/virtual_ips b/elements/keepalived/os-apply-config/etc/keepalived/virtual_ips
+new file mode 100644
+index 0000000..40cc27c
+--- /dev/null
++++ b/elements/keepalived/os-apply-config/etc/keepalived/virtual_ips
+@@ -0,0 +1,3 @@
++{{#virtual_ips}}
++{{ip}}
++{{/virtual_ips}}
diff --git a/0016-Use-keepalived-notify-script-if-virtual_interfaces-a.patch b/0016-Use-keepalived-notify-script-if-virtual_interfaces-a.patch
new file mode 100644
index 0000000..e69de29
diff --git a/openstack-tripleo-image-elements.spec b/openstack-tripleo-image-elements.spec
index e24a675..a316280 100644
--- a/openstack-tripleo-image-elements.spec
+++ b/openstack-tripleo-image-elements.spec
@@ -4,7 +4,7 @@
 Name:		openstack-tripleo-image-elements
 Summary:	OpenStack TripleO Image Elements for diskimage-builder
 Version:	0.8.10
-Release:	9%{?dist}
+Release:	10%{?dist}
 License:	ASL 2.0
 Group:		System Environment/Base
 URL:		https://wiki.openstack.org/wiki/TripleO
@@ -23,6 +23,9 @@ Patch0010: 0010-Combine-policy-installs-into-one-operation.patch
 Patch0011: 0011-Make-101-tuskar-ui-re-runnable.patch
 Patch0012: 0012-Copy-static-files-for-packaged-installs.patch
 Patch0013: 0013-Increase-rabbitmq-timeout.patch
+Patch0014: 0014-Wait-for-tuskar-api-to-start-up.patch
+Patch0015: 0015-Set-explicit-route-for-VIPs.patch
+Patch0016: 0016-Use-keepalived-notify-script-if-virtual_interfaces-a.patch
 
 BuildArch:	noarch
 BuildRequires:	python
@@ -54,6 +57,9 @@ program.
 %patch0011 -p1
 %patch0012 -p1
 %patch0013 -p1
+%patch0014 -p1
+%patch0015 -p1
+%patch0016 -p1
 
 %build
 %{__python} setup.py build
@@ -109,6 +115,11 @@ true
 %{_datadir}/tripleo-image-elements
 
 %changelog
+* Tue Dec 16 2014 James Slagle <jslagle at redhat.com> 0.8.10-10
+- Use keepalived notify script if virtual_interfaces are defined
+- Set explicit route for VIPs
+- Wait for tuskar-api to start up
+
 * Mon Dec 01 2014 James Slagle <jslagle at redhat.com> 0.8.10-9
 - Update 0001-Cinder-conf-patch.patch
 


More information about the scm-commits mailing list