From f2b3f0acc68899514383cb6d358ab637edab4c8d Mon Sep 17 00:00:00 2001 From: ZijianGuo Date: Tue, 18 Jun 2019 18:05:39 +0800 Subject: [PATCH] Fix the redis_connection_string for osprofiler and make it generic * When using redis as the backend of osprofiler, it cannot connect to redis because the redis_connection_string is incorrect. * Let other places that use redis also use this variable. Change-Id: I14de6597932d05cd7f804a35c6764ba4ae9087cd Closes-Bug: #1833200 Signed-off-by: ZijianGuo (cherry picked from commit cd836dd39f00c9a265571fc2745d9642ca72cd77) --- ansible/group_vars/all.yml | 3 +-- ansible/roles/cinder/templates/cinder.conf.j2 | 2 +- ansible/roles/gnocchi/templates/gnocchi.conf.j2 | 4 ++-- ansible/roles/mistral/templates/mistral.conf.j2 | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 980c213710..e30a117106 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -681,7 +681,7 @@ enable_kibana: "{{ 'yes' if enable_central_logging | bool or enable_monasca | bo #################### # Redis options #################### -redis_address: "{{ kolla_internal_fqdn }}" +redis_connection_string: "redis://{% for host in groups['redis'] %}{% if host == groups['redis'][0] %}admin:{{ redis_master_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}?sentinel=kolla{% else %}&sentinel_fallback={{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}{% endif %}{% endfor %}&socket_timeout=60&retry_on_timeout=yes" #################### # Osprofiler options @@ -689,7 +689,6 @@ redis_address: "{{ kolla_internal_fqdn }}" # valid values: ["elasticsearch", "redis"] osprofiler_backend: "elasticsearch" elasticsearch_connection_string: "elasticsearch://{{ elasticsearch_address }}:{{ elasticsearch_port }}" -redis_connection_string: "redis://:{{ redis_master_password }}@{{ redis_address }}:{{ redis_port }}" osprofiler_backend_connection_string: "{{ redis_connection_string if osprofiler_backend == 'redis' else elasticsearch_connection_string }}" #################### diff --git a/ansible/roles/cinder/templates/cinder.conf.j2 b/ansible/roles/cinder/templates/cinder.conf.j2 index 789010084f..5b131c1027 100644 --- a/ansible/roles/cinder/templates/cinder.conf.j2 +++ b/ansible/roles/cinder/templates/cinder.conf.j2 @@ -221,7 +221,7 @@ auth_endpoint = {{ keystone_internal_url }} [coordination] {% if enable_redis | bool %} -backend_url = redis://{% for host in groups['redis'] %}{% if host == groups['redis'][0] %}admin:{{ redis_master_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}?sentinel=kolla{% else %}&sentinel_fallback={{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}{% endif %}{% endfor %}&socket_timeout=60&retry_on_timeout=yes +backend_url = {{ redis_connection_string }} {% elif enable_etcd | bool %} # NOTE(jeffrey4l): python-etcd3 module do not support multi endpoint here. backend_url = etcd3://{{ hostvars[groups['etcd'][0]]['ansible_' + hostvars[groups['etcd'][0]]['api_interface']]['ipv4']['address'] }}:{{ etcd_client_port }} diff --git a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/gnocchi.conf.j2 index 9308e74c6c..98a607fa4f 100644 --- a/ansible/roles/gnocchi/templates/gnocchi.conf.j2 +++ b/ansible/roles/gnocchi/templates/gnocchi.conf.j2 @@ -4,7 +4,7 @@ debug = {{ gnocchi_logging_debug }} log_dir = /var/log/kolla/gnocchi {% if enable_redis | bool %} -coordination_url = redis://{% for host in groups['redis'] %}{% if host == groups['redis'][0] %}admin:{{ redis_master_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}?sentinel=kolla{% else %}&sentinel_fallback={{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}{% endif %}{% endfor %}&socket_timeout=60&retry_on_timeout=yes +coordination_url = {{ redis_connection_string }} {% endif %} {% if service_name == 'gnocchi-api' %} @@ -63,7 +63,7 @@ policy_file = {{ gnocchi_policy_file }} [incoming] {% if gnocchi_incoming_storage == 'redis' %} driver = redis -redis_url = redis://{% for host in groups['redis'] %}{% if host == groups['redis'][0] %}admin:{{ redis_master_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}?sentinel=kolla{% else %}&sentinel_fallback={{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}{% endif %}{% endfor %}&db=0&socket_timeout=60&retry_on_timeout=yes +redis_url = {{ redis_connection_string }} {% endif %} [storage] diff --git a/ansible/roles/mistral/templates/mistral.conf.j2 b/ansible/roles/mistral/templates/mistral.conf.j2 index 783c71ee92..1fb9314110 100644 --- a/ansible/roles/mistral/templates/mistral.conf.j2 +++ b/ansible/roles/mistral/templates/mistral.conf.j2 @@ -76,4 +76,4 @@ connection_string = {{ osprofiler_backend_connection_string }} {% endif %} [coordination] -backend_url = redis://{% for host in groups['redis'] %}{% if host == groups['redis'][0] %}admin:{{ redis_master_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}?sentinel=kolla{% else %}&sentinel_fallback={{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ redis_sentinel_port }}{% endif %}{% endfor %} +backend_url = {{ redis_connection_string }}