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. The association of the messaging
backend server to the oslo.messaging services will then be transparent
to the masakari service.

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

Change-Id: I127ce216cfb7b4d5755b8f0a68406bbd251fbdd2
This commit is contained in:
Andy Smith
2018-07-24 15:44:28 -04:00
committed by Jesse Pretorius (odyssey4me)
parent 3d06e07f9c
commit bb88051ec4
7 changed files with 72 additions and 19 deletions

View File

@@ -126,9 +126,28 @@ masakari_services:
# by the py_pkgs lookup.
masakari_role_project_group: masakari_all
## Configuration for RPC communications
masakari_rabbitmq_userid: masakari
masakari_rabbitmq_vhost: /masakari
masakari_rabbitmq_port: 5672
# Comma separated list of hosts
masakari_rabbitmq_servers: "{{ rabbitmq_all|default('127.0.0.1') }}"
## Configuration for Oslo Messaging
# RPC
masakari_oslomsg_rpc_transport: rabbit
masakari_oslomsg_rpc_servers: "{{ oslomsg_rpc_all|default('127.0.0.1') }}"
masakari_oslomsg_rpc_port: 5672
masakari_oslomsg_rpc_use_ssl: False
masakari_oslomsg_rpc_userid: masakari
masakari_oslomsg_rpc_vhost: /masakari
# Notify
masakari_oslomsg_notify_transport: rabbit
masakari_oslomsg_notify_servers: "{{ oslomsg_notify_all|default('127.0.0.1') }}"
masakari_oslomsg_notify_port: 5672
masakari_oslomsg_notify_use_ssl: False
masakari_oslomsg_notify_userid: "{{ masakari_oslomsg_rpc_userid }}"
masakari_oslomsg_notify_password: "{{ masakari_oslomsg_rpc_password }}"
masakari_oslomsg_notify_vhost: "{{ masakari_oslomsg_rpc_vhost }}"
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
masakari_oslomsg_amqp1_enabled: "{{ masakari_oslomsg_rpc_transport == 'amqp' }}"
masakari_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]

View File

@@ -1,3 +1,3 @@
masakari_container_mysql_password:
masakari_rabbitmq_password:
masakari_service_password:
masakari_oslomsg_rpc_password:
masakari_service_password:

View File

@@ -90,6 +90,21 @@
- Manage LB
- Restart masakari services
- name: Install optional pip packages
pip:
name: "{{ masakari_optional_oslomsg_amqp1_pip_packages }}"
state: "{{ masakari_pip_package_state }}"
virtualenv: "{{ masakari_bin | dirname }}"
virtualenv_site_packages: "no"
when: masakari_oslomsg_amqp1_enabled
register: install_optional_packages
until: install_optional_packages is success
retries: 5
delay: 2
notify:
- Manage LB
- Restart masakari services
- name: Remove python from path first (CentOS, openSUSE)
file:
path: "{{ masakari_bin | dirname }}/bin/python2.7"

View File

@@ -1,6 +1,6 @@
[DEFAULT]
enabled_apis = masakari_api
transport_url = rabbit://{% for host in masakari_rabbitmq_servers.split(',') %}{{ masakari_rabbitmq_userid }}:{{ masakari_rabbitmq_password }}@{{ host }}:{{ masakari_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ masakari_rabbitmq_vhost }}{% endif %}{% endfor %}
transport_url = {{ masakari_oslomsg_rpc_transport }}://{% for host in masakari_oslomsg_rpc_servers.split(',') %}{{ masakari_oslomsg_rpc_userid }}:{{ masakari_oslomsg_rpc_password }}@{{ host }}:{{ masakari_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ masakari_oslomsg_rpc_vhost }}{% if (masakari_oslomsg_rpc_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
# Enable to specify listening IP other than default
masakari_api_listen = 0.0.0.0
# Enable to specify port other than default
@@ -60,3 +60,9 @@ ignore_instances_in_error_state = false
[instance_failure]
process_all_instances = false
[oslo_messaging_rabbit]
ssl = {{ masakari_oslomsg_notify_use_ssl | bool }}
[oslo_messaging_notifications]
transport_url = {{ masakari_oslomsg_notify_transport }}://{% for host in masakari_oslomsg_notify_servers.split(',') %}{{ masakari_oslomsg_notify_userid }}:{{ masakari_oslomsg_notify_password }}@{{ host }}:{{ masakari_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ masakari_oslomsg_notify_vhost }}{% if (masakari_oslomsg_notify_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}

View File

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

View File

@@ -14,16 +14,21 @@
# limitations under the License.
masakari_service_tenant_name: service
masakari_rabbitmq_port: "{{ rabbitmq_port }}"
masakari_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
masakari_rabbitmq_servers: "{{ rabbitmq_servers }}"
masakari_rabbitmq_host_group: "{{ rabbitmq_host_group }}"
masakari_oslomsg_rpc_port: "{{ oslomsg_rpc_port }}"
masakari_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl }}"
masakari_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers }}"
masakari_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group }}"
masakari_oslomsg_notify_port: "{{ oslomsg_notify_port }}"
masakari_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl }}"
masakari_oslomsg_notify_servers: "{{ oslomsg_notify_servers }}"
masakari_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group }}"
masakari_service_publicuri: "{{ masakari_service_proto }}://{{ hostvars[groups['masakari_all'][0]]['ansible_host'] }}:{{ masakari_service_port }}"
masakari_service_adminurl: "{{ masakari_service_proto }}://{{ hostvars[groups['masakari_all'][0]]['ansible_host'] }}:{{ masakari_service_port }}"
masakari_service_adminuri: "{{ masakari_service_proto }}://{{ hostvars[groups['masakari_all'][0]]['ansible_host'] }}:{{ masakari_service_port }}"
masakari_aodh_enabled: false
masakari_gnocchi_enabled: false
masakari_rabbitmq_password: "secrete"
masakari_oslomsg_rpc_password: "secrete"
masakari_oslomsg_notify_password: "{{ masakari_oslomsg_rpc_password }}"
masakari_service_password: "secrete"
masakari_container_mysql_password: "secrete"
masakari_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: "{{ masakari_rabbitmq_vhost }}"
user_name: "{{ masakari_rabbitmq_userid }}"
user_password: "{{ masakari_rabbitmq_password }}"
when: groups['rabbitmq_all'] is defined
- include: common/ensure-oslomsg.yml
rpc_vhost: "{{ masakari_oslomsg_rpc_vhost }}"
rpc_user: "{{ masakari_oslomsg_rpc_userid }}"
rpc_password: "{{ masakari_oslomsg_rpc_password }}"
notify_vhost: "{{ masakari_oslomsg_notify_vhost }}"
notify_user: "{{ masakari_oslomsg_notify_userid }}"
notify_password: "{{ masakari_oslomsg_notify_password }}"
roles:
- role: os_masakari
vars_files: