Make haproxy proxy to the right glance_api backend

Since glance_api only start one container when using file
backend, the haproxy should follow this rule.

See: https://review.openstack.org/#/c/448654

Closes-Bug: #1722422

Change-Id: Id3519581e0f54509dacd24d0dd542c630342c771
This commit is contained in:
jiangpch 2017-10-09 02:47:05 -04:00 committed by Murali Annamneni
parent 8219542f89
commit d57c7019a9
3 changed files with 3 additions and 4 deletions

View File

@ -640,6 +640,7 @@ glance_backend_vmware: "no"
glance_backend_swift: "{{ not (enable_ceph | bool) and enable_swift | bool }}"
glance_file_datadir_volume: "glance"
glance_enable_rolling_upgrade: "no"
glance_api_hosts: "{{ [groups['glance-api']|first] if glance_backend_file | bool and glance_file_datadir_volume == 'glance' else groups['glance-api'] }}"
#######################
# Barbican options

View File

@ -103,8 +103,6 @@ glance_backends:
glance_store_backends: "{{ glance_backends|selectattr('enabled', 'equalto', true)|list }}"
glance_api_hosts: "{{ groups['glance-api']|first if glance_backend_file | bool and glance_file_datadir_volume == 'glance' else groups['glance-api'] }}"
####################
# OpenStack
####################

View File

@ -144,7 +144,7 @@ listen glance_api
{% for http_option in haproxy_listen_http_extra %}
{{ http_option }}
{% endfor %}
{% for host in groups['glance-api'] %}
{% for host in glance_api_hosts %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ glance_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% if haproxy_enable_external_vip | bool %}
@ -158,7 +158,7 @@ listen glance_api_external
{% endfor %}
http-request del-header X-Forwarded-Proto
http-request set-header X-Forwarded-Proto https if { ssl_fc }
{% for host in groups['glance-api'] %}
{% for host in glance_api_hosts %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ glance_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% endif %}