Merge "Make sure kitchen test dependencies formulas are always fetched from correct branch"
diff --git a/README.rst b/README.rst
index 713026d..624468c 100644
--- a/README.rst
+++ b/README.rst
@@ -143,6 +143,25 @@
strategy: ENCRYPT
secret_key: secret
+Setup redis coordination_backend url:
+---------------------------
+.. code-block:: yaml
+
+ aodh:
+ server:
+ coordination_backend:
+ engine: redis
+ redis:
+ password: pswd
+ user: openstack
+ db: '0'
+ sentinel:
+ host: 127.0.0.1
+ master_name: master_1
+ fallback:
+ - host: 127.0.1.1
+ - host: 127.0.2.1
+
Development and testing
=======================
diff --git a/aodh/files/mitaka/aodh.conf.Debian b/aodh/files/mitaka/aodh.conf.Debian
index 2cb0b91..811e00e 100644
--- a/aodh/files/mitaka/aodh.conf.Debian
+++ b/aodh/files/mitaka/aodh.conf.Debian
@@ -346,8 +346,19 @@
# workload partitioning and will only function correctly if a single
# instance of that service is running. (string value)
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination.
# (floating point value)
diff --git a/aodh/files/newton/aodh.conf.Debian b/aodh/files/newton/aodh.conf.Debian
index c82c19d..712787d 100644
--- a/aodh/files/newton/aodh.conf.Debian
+++ b/aodh/files/newton/aodh.conf.Debian
@@ -407,8 +407,19 @@
# service is running. (string value)
#backend_url = <None>
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination. (floating
# point value)
diff --git a/aodh/files/ocata/aodh.conf.Debian b/aodh/files/ocata/aodh.conf.Debian
index c82c19d..712787d 100644
--- a/aodh/files/ocata/aodh.conf.Debian
+++ b/aodh/files/ocata/aodh.conf.Debian
@@ -407,8 +407,19 @@
# service is running. (string value)
#backend_url = <None>
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination. (floating
# point value)
diff --git a/aodh/files/pike/aodh.conf.Debian b/aodh/files/pike/aodh.conf.Debian
index dc1e62e..cca7e72 100644
--- a/aodh/files/pike/aodh.conf.Debian
+++ b/aodh/files/pike/aodh.conf.Debian
@@ -415,8 +415,19 @@
# service is running. (string value)
#backend_url = <None>
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination. (floating
# point value)
diff --git a/aodh/files/queens/aodh.conf.Debian b/aodh/files/queens/aodh.conf.Debian
index 9ba0bce..9514eb2 100644
--- a/aodh/files/queens/aodh.conf.Debian
+++ b/aodh/files/queens/aodh.conf.Debian
@@ -94,8 +94,19 @@
# a single instance of the service is running. (string value)
#backend_url = <None>
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination. (floating
# point value)
diff --git a/aodh/files/rocky/aodh.conf.Debian b/aodh/files/rocky/aodh.conf.Debian
index 13c908c..80bf3fe 100644
--- a/aodh/files/rocky/aodh.conf.Debian
+++ b/aodh/files/rocky/aodh.conf.Debian
@@ -98,8 +98,19 @@
# a single instance of the service is running. (string value)
#backend_url = <None>
{%- if server.coordination_backend is defined %}
+{%- if server.coordination_backend.redis is defined and server.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = server.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
+ if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
+ if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
+ {%- else %}
+backend_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
+ {%- endif %}
+{%- elif server.coordination_backend.url is defined %}
backend_url = {{ server.coordination_backend.url }}
-{%- endif %}
+{%- endif %}
+{%- endif %}
# Number of seconds between heartbeats for distributed coordination. (floating
# point value)
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index 9cf1c07..300094c 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -60,6 +60,19 @@
enabled: true
strategy: ENCRYPT
secret_key: secret
+ coordination_backend:
+ url: redis://127.0.0.1/test
+ engine: redis
+ redis:
+ password: pswd
+ user: openstack
+ db: '0'
+ sentinel:
+ host: 127.0.0.1
+ master_name: master_1
+ fallback:
+ - host: 127.0.1.1
+ - host: 127.0.2.1
apache:
server:
enabled: true