Fix mistral service

- Add mistral in HAproxy
- Set mistral api to bind on api_interface
- Fix mistral endpoint
- Add database population on bootstraping
- Add mistral port prechecks

Change-Id: If1617fb9dcd8b3bbd4f94c68ca87c36e39711016
Closes-Bug: #1626570
This commit is contained in:
Eduardo Gonzalez 2016-09-22 17:27:14 +02:00
parent 8bde923bba
commit a71874f24f
5 changed files with 42 additions and 8 deletions

View File

@ -552,6 +552,22 @@ listen congress_api_external
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if enable_mistral | bool %}
listen mistral_api
bind {{ kolla_internal_vip_address }}:{{ mistral_api_port }}
{% for host in groups['mistral-api'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mistral_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% if haproxy_enable_external_vip | bool %}
listen mistral_api_external
bind {{ kolla_external_vip_address }}:{{ mistral_api_port }} {{ tls_bind_info }}
{% for host in groups['mistral-api'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mistral_api_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% endif %}
{% endif %}
# (NOTE): This defaults section deletes forwardfor as recomended by: # (NOTE): This defaults section deletes forwardfor as recomended by:
# https://marc.info/?l=haproxy&m=141684110710132&w=1 # https://marc.info/?l=haproxy&m=141684110710132&w=1

View File

@ -28,9 +28,9 @@ mistral_api_image_full: "{{ mistral_api_image }}:{{ mistral_api_tag }}"
#################### ####################
# OpenStack # OpenStack
#################### ####################
mistral_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}" mistral_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}/v2"
mistral_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}" mistral_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ mistral_api_port }}/v2"
mistral_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ mistral_api_port }}" mistral_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ mistral_api_port }}/v2"
mistral_logging_debug: "{{ openstack_logging_debug }}" mistral_logging_debug: "{{ openstack_logging_debug }}"

View File

@ -7,13 +7,14 @@ log_dir = /var/log/kolla/mistral
# stderr and collected by Docker # stderr and collected by Docker
use_stderr = False use_stderr = False
{% if service_name == 'mistral-api' %}
bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
bind_port = {{ mistral_api_port }}
{% endif %}
transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %} transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %}
{% if service_name == 'mistral-api' %}
[api]
host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
port = {{ mistral_api_port }}
{% endif %}
[database] [database]
connection = mysql+pymysql://{{ mistral_database_user }}:{{ mistral_database_password }}@{{ mistral_database_address }}/{{ mistral_database_name }} connection = mysql+pymysql://{{ mistral_database_user }}:{{ mistral_database_password }}@{{ mistral_database_address }}/{{ mistral_database_name }}
max_retries = -1 max_retries = -1

View File

@ -553,6 +553,22 @@
state: stopped state: stopped
when: inventory_hostname in groups['haproxy'] when: inventory_hostname in groups['haproxy']
- name: Checking free port for Mistral API
wait_for:
host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
port: "{{ mistral_api_port }}"
connect_timeout: 1
state: stopped
when: inventory_hostname in groups['mistral-api']
- name: Checking free port for Mistral API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ mistral_api_port }}"
connect_timeout: 1
state: stopped
when: inventory_hostname in groups['haproxy']
- name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node - name: Checking if kolla_internal_vip_address and kolla_external_vip_address are not pingable from any node
command: ping -c 3 {{ item }} command: ping -c 3 {{ item }}
register: ping_output register: ping_output

View File

@ -4,5 +4,6 @@
# of the KOLLA_BOOTSTRAP variable being set, including empty. # of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head
mistral-db-manage --config-file /etc/mistral/mistral.conf populate
exit 0 exit 0
fi fi