Merge "Make sure kitchen test dependencies formulas are always fetched from correct branch"
diff --git a/README.rst b/README.rst
index ad12aad..8e8f36e 100644
--- a/README.rst
+++ b/README.rst
@@ -333,6 +333,64 @@
strategy: ENCRYPT
secret_key: secret
+Setup redis coordination_backend url:
+---------------------------
+.. code-block:: yaml
+
+ gnocchi:
+ common:
+ 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
+
+Setup redis storage url:
+-----------------------
+.. code-block:: yaml
+
+ gnocchi:
+ common:
+ storage:
+ driver: 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
+
+Setup redis incoming storage url:
+---------------------------
+.. code-block:: yaml
+
+ gnocchi:
+ common:
+ storage:
+ incoming:
+ driver: 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
+
More Information
================
diff --git a/gnocchi/files/4.0/gnocchi.conf b/gnocchi/files/4.0/gnocchi.conf
index e1bd172..1aa8b77 100644
--- a/gnocchi/files/4.0/gnocchi.conf
+++ b/gnocchi/files/4.0/gnocchi.conf
@@ -198,5 +198,16 @@
{%- endif %}
{%- if cfg.coordination_backend is defined %}
+{%- if cfg.get('coordination_backend', {}).redis is defined and cfg.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = cfg.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+coordination_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 %}
+coordination_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 cfg.coordination_backend.url is defined %}
coordination_url = {{ cfg.coordination_backend.url }}
{%- endif %}
+{%- endif %}
diff --git a/gnocchi/files/4.0/storage/_redis.conf b/gnocchi/files/4.0/storage/_redis.conf
index bede88b..6838dd1 100644
--- a/gnocchi/files/4.0/storage/_redis.conf
+++ b/gnocchi/files/4.0/storage/_redis.conf
@@ -1,3 +1,12 @@
-{%- if _storage.redis_url is defined %}
+{%- if _storage.redis is defined %}
+ {%- set conn = _storage.redis %}
+ {%- if conn.sentinel is defined %}
+redis_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 %}
+redis_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 _storage.redis_url is defined %}
redis_url = {{ _storage.redis_url }}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/gnocchi/files/4.2/gnocchi.conf b/gnocchi/files/4.2/gnocchi.conf
index fef9fbd..7f59338 100644
--- a/gnocchi/files/4.2/gnocchi.conf
+++ b/gnocchi/files/4.2/gnocchi.conf
@@ -47,8 +47,19 @@
# Coordination driver URL (string value)
#coordination_url = <None>
{%- if cfg.coordination_backend is defined %}
+{%- if cfg.get('coordination_backend', {}).redis is defined and cfg.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = cfg.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+coordination_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 %}
+coordination_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 cfg.coordination_backend.url is defined %}
coordination_url = {{ cfg.coordination_backend.url }}
{%- endif %}
+{%- endif %}
# Number of threads to use to parallelize some operations. Default is set to
# the number of CPU available. (integer value)
diff --git a/gnocchi/files/4.2/storage/_redis.conf b/gnocchi/files/4.2/storage/_redis.conf
index bede88b..6838dd1 100644
--- a/gnocchi/files/4.2/storage/_redis.conf
+++ b/gnocchi/files/4.2/storage/_redis.conf
@@ -1,3 +1,12 @@
-{%- if _storage.redis_url is defined %}
+{%- if _storage.redis is defined %}
+ {%- set conn = _storage.redis %}
+ {%- if conn.sentinel is defined %}
+redis_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 %}
+redis_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 _storage.redis_url is defined %}
redis_url = {{ _storage.redis_url }}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/gnocchi/files/4.3/gnocchi.conf b/gnocchi/files/4.3/gnocchi.conf
index c0d8a92..7b838fd 100644
--- a/gnocchi/files/4.3/gnocchi.conf
+++ b/gnocchi/files/4.3/gnocchi.conf
@@ -47,8 +47,19 @@
# Coordination driver URL (string value)
#coordination_url = <None>
{%- if cfg.coordination_backend is defined %}
+{%- if cfg.get('coordination_backend', {}).redis is defined and cfg.coordination_backend.get('engine', redis) == 'redis' %}
+ {%- set conn = cfg.coordination_backend.redis %}
+ {%- if conn.sentinel is defined %}
+coordination_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 %}
+coordination_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 cfg.coordination_backend.url is defined %}
coordination_url = {{ cfg.coordination_backend.url }}
{%- endif %}
+{%- endif %}
# Number of threads to use to parallelize some operations. Default is set to
# the number of CPU available. (integer value)
diff --git a/gnocchi/files/4.3/storage/_redis.conf b/gnocchi/files/4.3/storage/_redis.conf
index bede88b..6838dd1 100644
--- a/gnocchi/files/4.3/storage/_redis.conf
+++ b/gnocchi/files/4.3/storage/_redis.conf
@@ -1,3 +1,12 @@
-{%- if _storage.redis_url is defined %}
+{%- if _storage.redis is defined %}
+ {%- set conn = _storage.redis %}
+ {%- if conn.sentinel is defined %}
+redis_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 %}
+redis_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 _storage.redis_url is defined %}
redis_url = {{ _storage.redis_url }}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index ba5ee05..39738f8 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -21,6 +21,16 @@
incoming:
driver: redis
redis_url: redis://127.0.0.2/test_incoming
+ 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
ceph_pool: gnocchi_incoming
ceph_username: gnocchi
ceph_secret: workshop
@@ -30,6 +40,17 @@
file_basepath: /var/lib/gnocchi_incoming
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
server:
enabled: true
debug: true