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 template
* Add oslo.messaging to tests inventory and update tests
* Update readme
* Install extra packages for optional drivers
* Add release note

Change-Id: Ie43bcf4c5a8414072f1917ab8b30a034a514c51b
This commit is contained in:
Andy Smith 2018-07-25 08:50:05 -04:00 committed by Jesse Pretorius (odyssey4me)
parent 4bffc1e91f
commit cbe8947272
8 changed files with 104 additions and 62 deletions

View File

@ -17,8 +17,8 @@ This role will install the following:
* watcher-decision-engine
* watcher-applier
The role will configure Watcher, but does not provision RabbitMQ or
MariaDB.
The role will configure Watcher, but does not provision messaging
backend or MariaDB.
This role is intended to work primarily with OpenStack-Ansible, but
consuming this role by setting the appropriate variables should be
@ -43,27 +43,9 @@ Example Playbook
roles:
- { role: "os_watcher", tags: [ "os-watcher" ] }
vars:
watcher_developer_mode: True
watcher_galera_address: 10.100.102.101
watcher_galera_database: watcher
watcher_galera_user: watcher
watcher_galera_password: "secrete"
watcher_rabbitmq_port: "{{ rabbitmq_port }}"
watcher_rabbitmq_servers: "{{ rabbitmq_servers }}"
watcher_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
watcher_rabbitmq_password: "secrete"
watcher_rabbitmq_userid: watcher
watcher_rabbitmq_vhost: /watcher
watcher_requirements_git_install_branch: master
watcher_service_adminurl: "http://{{ internal_lb_vip_address }}:9322"
watcher_oslomsg_rpc_password: "secrete"
watcher_service_password: "secrete"
watcher_service_project_domain_id: default
watcher_service_project_name: service
watcher_service_region: RegionOne
watcher_service_user_domain_id: default
watcher_service_user_name: watcher
watcher_bin: "/openstack/venvs/watcher-{{ watcher_venv_tag }}/bin"
watcher_venv_tag: "testing"
Tags
====

View File

@ -60,15 +60,28 @@ watcher_galera_address: "{{ galera_address | default('127.0.0.1') }}"
watcher_galera_user: watcher
watcher_galera_database: watcher
## RabbitMQ info
watcher_rabbitmq_userid: watcher
watcher_rabbitmq_vhost: /watcher
watcher_rabbitmq_port: 5672
watcher_rabbitmq_use_ssl: False
# Comma separated list of hosts
watcher_rabbitmq_servers: 127.0.0.1
# Inventory group containing the hosts for the cluster
watcher_rabbitmq_host_group: "rabbitmq_all"
## Oslo Messaging info
# RPC
watcher_oslomsg_rpc_transport: rabbit
watcher_oslomsg_rpc_servers: 127.0.0.1
watcher_oslomsg_rpc_port: 5672
watcher_oslomsg_rpc_use_ssl: False
watcher_oslomsg_rpc_userid: watcher
watcher_oslomsg_rpc_vhost: /watcher
# Notify
watcher_oslomsg_notify_transport: rabbit
watcher_oslomsg_notify_servers: 127.0.0.1
watcher_oslomsg_notify_port: 5672
watcher_oslomsg_notify_use_ssl: False
watcher_oslomsg_notify_userid: "{{ watcher_oslomsg_rpc_userid }}"
watcher_oslomsg_notify_password: "{{ watcher_oslomsg_rpc_password }}"
watcher_oslomsg_notify_vhost: "{{ watcher_oslomsg_rpc_vhost }}"
# Inventory group containing the hosts for the messaging backend
watcher_oslomsg_rpc_host_group: "oslomsg_rpc_all"
watcher_oslomsg_notify_host_group: "oslomsg_notify_all"
watcher_api_program_name: watcher-api
watcher_decision_engine_program_name: watcher-decision-engine
@ -106,6 +119,13 @@ watcher_pip_packages:
- python-memcached
- watcher
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
watcher_oslomsg_amqp1_enabled: "{{ watcher_oslomsg_rpc_transport == 'amqp' }}"
watcher_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]
# watcher services info
watcher_role_name: admin
@ -117,7 +137,8 @@ watcher_service_names:
watcher_required_secrets:
- watcher_galera_password
- watcher_rabbitmq_password
- watcher_oslomsg_rpc_password
- watcher_oslomsg_notify_password
- watcher_service_password
# This variable is used by the repo_build process to determine

View File

@ -0,0 +1,22 @@
---
features:
- Support separate oslo.messaging services for RPC and Notifications
to enable operation of separate and different messaging backend
servers.
deprecations:
- |
The rabbitmq server parameters have been replaced by corresponding
oslo.messaging RPC and Notify parameters in order to abstract the
messaging service from the actual backend server deployment.
- watcher_oslomsg_rpc_servers replaces watcher_rabbitmq_servers
- watcher_oslomsg_rpc_port replaces watcher_rabbitmq_port
- watcher_oslomsg_rpc_userid replaces watcher_rabbitmq_userid
- watcher_oslomsg_rpc_vhost replaces watcher_rabbitmq_vhost
- watcher_oslomsg_rpc_use_ssl replaces watcher_rabbitmq_use_ssl
- watcher_oslomsg_rpc_password replaces watcher_rabbitmq_password
- added watcher_oslo_msg_notify_servers
- added watcher_oslo_msg_notify_port
- added watcher_oslo_msg_notify_use_ssl
- added watcher_oslo_msg_notify_userid
- added watcher_oslo_msg_notify_vhost
- added watcher_oslo_msg_notify_password

View File

@ -80,6 +80,21 @@
when: watcher_get_venv | failed or watcher_get_venv | skipped
notify: Restart watcher services
- name: Install optional pip packages
pip:
name: "{{ watcher_optional_oslomsg_amqp1_pip_packages }}"
state: "{{ watcher_pip_package_state }}"
virtualenv: "{{ watcher_bin | dirname }}"
virtualenv_site_packages: "no"
when: watcher_oslomsg_amqp1_enabled
register: install_optional_packages
until: install_optional_packages is success
retries: 5
delay: 2
notify:
- Manage LB
- Restart watcher services
# NOTE(odyssey4me):
# We reinitialize the venv to ensure that the right
# version of python is in the venv, but we do not

View File

@ -8,13 +8,13 @@ logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %
control_exchange = watcher
debug = True
transport_url = {{ watcher_oslomsg_rpc_transport }}://{% for host in watcher_oslomsg_rpc_servers.split(',') %}{{ watcher_oslomsg_rpc_userid }}:{{ watcher_oslomsg_rpc_password }}@{{ host }}:{{ watcher_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ watcher_oslomsg_rpc_vhost }}{% if (watcher_oslomsg_rpc_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[oslo_messaging_rabbit]
rabbit_port = {{ watcher_rabbitmq_port }}
rabbit_userid = {{ watcher_rabbitmq_userid }}
rabbit_password = {{ watcher_rabbitmq_password }}
rabbit_virtual_host = {{ watcher_rabbitmq_vhost }}
rabbit_hosts = {{ watcher_rabbitmq_servers }}
ssl = {{ watcher_rabbitmq_use_ssl }}
ssl = {{ watcher_oslomsg_notify_use_ssl | bool }}
[oslo_messaging_notifications]
transport_url = {{ watcher_oslomsg_notify_transport }}://{% for host in watcher_oslomsg_notify_servers.split(',') %}{{ watcher_oslomsg_notify_userid }}:{{ watcher_oslomsg_notify_password }}@{{ host }}:{{ watcher_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ watcher_oslomsg_notify_vhost }}{% if (watcher_oslomsg_notify_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[database]
connection = mysql+pymysql://{{ watcher_galera_user }}:{{ watcher_galera_password }}@{{ watcher_galera_address }}/{{ watcher_galera_database }}?charset=utf8

View File

@ -7,6 +7,12 @@ openstack1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
infra1
openstack1
[oslomsg_rpc_all]
infra1
[oslomsg_notify_all]
infra1
[rabbitmq_all]
infra1

View File

@ -15,12 +15,20 @@
watcher_developer_mode: True
watcher_galera_password: "secrete"
watcher_rabbitmq_port: "{{ rabbitmq_port }}"
watcher_rabbitmq_servers: "{{ rabbitmq_servers }}"
watcher_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
watcher_rabbitmq_password: "{{ rabbitmq_password }}"
watcher_rabbitmq_userid: watcher
watcher_rabbitmq_vhost: /watcher
watcher_oslomsg_rpc_port: "{{ oslomsg_rpc_port }}"
watcher_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl }}"
watcher_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers }}"
watcher_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group }}"
watcher_oslomsg_rpc_password: "{{ oslomsg_rpc_password }}"
watcher_oslomsg_rpc_userid: watcher
watcher_oslomsg_rpc_vhost: /watcher
watcher_oslomsg_notify_port: "{{ oslomsg_notify_port }}"
watcher_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl }}"
watcher_oslomsg_notify_servers: "{{ oslomsg_notify_servers }}"
watcher_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group }}"
watcher_oslomsg_notify_password: "{{ oslomsg_notify_password }}"
watcher_oslomsg_notify_userid: watcher
watcher_oslomsg_notify_vhost: /watcher
watcher_requirements_git_install_branch: master
watcher_service_adminurl: "http://{{ hostvars[groups['watcher_api'][0]]['ansible_host'] }}:9322"
watcher_service_password: "secrete"

View File

@ -31,25 +31,13 @@
- libvirt-dev
when: inventory_hostname in groups['watcher_all']
- name: Ensure rabbitmq vhost
rabbitmq_vhost:
name: "{{ watcher_rabbitmq_vhost }}"
state: "present"
delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}"
when: inventory_hostname == groups['watcher_all'][0]
- name: Ensure rabbitmq user
rabbitmq_user:
user: "{{ watcher_rabbitmq_userid }}"
password: "{{ watcher_rabbitmq_password }}"
vhost: "{{ watcher_rabbitmq_vhost }}"
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
state: "present"
delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}"
when: inventory_hostname == groups['watcher_all'][0]
no_log: true
- include: common/ensure-oslomsg.yml
rpc_vhost: "{{ watcher_oslomsg_rpc_vhost }}"
rpc_user: "{{ watcher_oslomsg_rpc_userid }}"
rpc_password: "{{ watcher_oslomsg_rpc_password }}"
notify_vhost: "{{ watcher_oslomsg_notify_vhost }}"
notify_user: "{{ watcher_oslomsg_notify_userid }}"
notify_password: "{{ watcher_oslomsg_notify_password }}"
roles:
- role: "os_watcher"