Update to use oslo.messaging service for RPC and Notify

This introduces oslo.messaging variables that define the RPC and
Notify transports for the OpenStack services. These parameters replace
the rabbitmq values and are used to generate the messaging
transport_url for the service.

This patch:
* Add oslo.messaging variables for RPC and Notify to defaults
* Add transport_url generation to conf
* Add oslo.messaging to tests inventory and update tests
* Install extra packages for optional drivers

Change-Id: I88fa6bd04ebad08211570d46ed464409b5896123
This commit is contained in:
Andy Smith 2018-07-25 06:37:18 -04:00 committed by Jesse Pretorius (odyssey4me)
parent e911fcf505
commit 96e911f446
7 changed files with 75 additions and 23 deletions

View File

@ -59,14 +59,31 @@ tacker_system_shell: /bin/false
tacker_system_comment: tacker system user
tacker_system_user_home: "/var/lib/{{ tacker_system_user_name }}"
## Configuration for Oslo Messaging
## RabbitMQ info
# RPC
tacker_oslomsg_rpc_transport: rabbit
tacker_oslomsg_rpc_servers: "{{ oslomsg_rpc_all|default('127.0.0.1') }}"
tacker_oslomsg_rpc_port: 5672
tacker_oslomsg_rpc_use_ssl: False
tacker_oslomsg_rpc_userid: tacker
tacker_oslomsg_rpc_vhost: /tacker
tacker_rabbitmq_userid: tacker
tacker_rabbitmq_vhost: /tacker
glance_rabbitmq_port: 5672
glance_rabbitmq_servers: 127.0.0.1
glance_rabbitmq_use_ssl: False
# Notify
tacker_oslomsg_notify_transport: rabbit
tacker_oslomsg_notify_servers: "{{ oslomsg_notify_all|default('127.0.0.1') }}"
tacker_oslomsg_notify_port: 5672
tacker_oslomsg_notify_use_ssl: False
tacker_oslomsg_notify_userid: "{{ tacker_oslomsg_rpc_userid }}"
tacker_oslomsg_notify_password: "{{ tacker_oslomsg_rpc_password }}"
tacker_oslomsg_notify_vhost: "{{ tacker_oslomsg_rpc_vhost }}"
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
tacker_oslomsg_amqp1_enabled: "{{ tacker_oslomsg_rpc_transport == 'amqp' }}"
tacker_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]
## Database info
tacker_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"

View File

@ -96,6 +96,20 @@
notify:
- Restart tacker services
- name: Install optional pip packages
pip:
name: "{{ tacker_optional_oslomsg_amqp1_pip_packages }}"
state: "{{ tacker_pip_package_state }}"
virtualenv: "{{ tacker_bin | dirname }}"
virtualenv_site_packages: "no"
when: tacker_oslomsg_amqp1_enabled
register: install_optional_packages
until: install_optional_packages is success
retries: 5
delay: 2
notify:
- Restart tacker services
- name: Remove python from path first (CentOS, openSUSE)
file:
path: "{{ tacker_bin | dirname }}/bin/python2.7"

View File

@ -1,26 +1,26 @@
---
# tacker messaging setup
# TODO(ansmith): change to common messaging setup
- name: Ensure Rabbitmq vhost
rabbitmq_vhost:
name: "{{ tacker_rabbitmq_vhost }}"
name: "{{ tacker_oslomsg_rpc_vhost }}"
state: "present"
delegate_to: "{{ groups['rabbitmq_all'][0] }}"
delegate_to: "{{ groups['oslomsg_rpc_all'][0] }}"
tags:
- tacker-rabbitmq
- tacker-rabbitmq-vhost
- name: Ensure rabbitmq user
rabbitmq_user:
user: "{{ tacker_rabbitmq_userid }}"
password: "{{ tacker_rabbitmq_password }}"
vhost: "{{ tacker_rabbitmq_vhost }}"
user: "{{ tacker_oslomsg_rpc_userid }}"
password: "{{ tacker_oslomsg_rpc_password }}"
vhost: "{{ tacker_oslomsg_rpc_vhost }}"
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
state: "present"
delegate_to: "{{ groups['rabbitmq_all'][0] }}"
delegate_to: "{{ groups['oslomsg_rpc_all'][0] }}"
no_log: true
tags:
- tacker-rabbitmq

View File

@ -4,6 +4,8 @@
verbose = {{ verbose }}
debug = {{ debug }}
# oslo.messaging rpc transport
transport_url = {{ tacker_oslomsg_rpc_transport }}://{% for host in tacker_oslomsg_rpc_servers.split(',') %}{{ tacker_oslomsg_rpc_userid }}:{{ tacker_oslomsg_rpc_password }}@{{ host }}:{{ tacker_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ tacker_oslomsg_rpc_vhost }}{% if (tacker_oslomsg_rpc_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
# Where to store Tacker state files. This directory must be writable by the
# user executing the agent.
@ -103,3 +105,9 @@ monitor_driver = ping, http_ping
[vim_keys]
openstack = {{ tacker_etc_dir }}/vim/fernet_keys
[oslo_messaging_rabbit]
ssl = {{ tacker_oslomsg_notify_use_ssl | bool }}
[oslo_messaging_notifications]
transport_url = {{ tacker_oslomsg_notify_transport }}://{% for host in tacker_oslomsg_notify_servers.split(',') %}{{ tacker_oslomsg_notify_userid }}:{{ tacker_oslomsg_notify_password }}@{{ host }}:{{ tacker_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ tacker_oslomsg_notify_vhost }}{% if (tacker_oslomsg_notify_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}

View File

@ -7,6 +7,12 @@ tacker1
infra1
tacker1
[oslomsg_rpc_all]
infra1
[oslomsg_notify_all]
infra1
[rabbitmq_all]
infra1

View File

@ -14,16 +14,21 @@
# limitations under the License.
tacker_service_tenant_name: service
tacker_rabbitmq_port: "{{ rabbitmq_port }}"
tacker_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
tacker_rabbitmq_servers: "{{ rabbitmq_servers }}"
tacker_rabbitmq_host_group: "{{ rabbitmq_host_group }}"
tacker_oslomsg_rpc_port: "{{ oslomsg_rpc_port }}"
tacker_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl }}"
tacker_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers }}"
tacker_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group }}"
tacker_oslomsg_notify_port: "{{ oslomsg_notify_port }}"
tacker_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl }}"
tacker_oslomsg_notify_servers: "{{ oslomsg_notify_servers }}"
tacker_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group }}"
tacker_service_publicuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_service_adminurl: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_service_adminuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}"
tacker_aodh_enabled: false
tacker_gnocchi_enabled: false
tacker_rabbitmq_password: "secrete"
tacker_oslomsg_rpc_password: "secrete"
tacker_oslomsg_notify_password: "{{ tacker_oslomsg_rpc_password }}"
tacker_service_password: "secrete"
tacker_container_mysql_password: "secrete"
tacker_developer_mode: true

View File

@ -19,11 +19,13 @@
gather_facts: true
any_errors_fatal: true
pre_tasks:
- include: common/ensure-rabbitmq.yml
vhost_name: "{{ tacker_rabbitmq_vhost }}"
user_name: "{{ tacker_rabbitmq_userid }}"
user_password: "{{ tacker_rabbitmq_password }}"
when: groups['rabbitmq_all'] is defined
- include: common/ensure-oslomsg.yml
rpc_vhost: "{{ tacker_oslomsg_rpc_vhost }}"
rpc_user: "{{ tacker_oslomsg_rpc_userid }}"
rpc_password: "{{ tacker_oslomsg_rpc_password }}"
notify_vhost: "{{ tacker_oslomsg_notify_vhost }}"
notify_user: "{{ tacker_oslomsg_notify_userid }}"
notify_password: "{{ tacker_oslomsg_notify_password }}"
roles:
- role: os_tacker
vars_files: