From e587d74d29747e3108588ca0fe93f6dd2ee88936 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 2 Jul 2018 13:09:28 -0400 Subject: [PATCH] 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 aure 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 magnum 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 * Update tests * Update examples * Add release note Change-Id: Ib44af3b1d153742975351a321d65c8812a994370 --- defaults/main.yml | 22 ++++++++++++++----- doc/source/index.rst | 14 ++++++++---- examples/playbook.yml | 6 +++-- ...ng-separate-backends-a3af6957a984ac51.yaml | 20 +++++++++++++++++ templates/magnum.conf.j2 | 7 ++++-- tests/inventory | 6 +++++ tests/os_magnum-overrides.yml | 9 ++++---- tests/test-install-magnum.yml | 11 ++++++---- 8 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/oslo-messaging-separate-backends-a3af6957a984ac51.yaml diff --git a/defaults/main.yml b/defaults/main.yml index a71bb43..209bf07 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -74,12 +74,22 @@ magnum_galera_user: magnum magnum_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" magnum_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}" -# Rabbit vars -magnum_rabbitmq_userid: magnum -magnum_rabbitmq_vhost: /magnum -magnum_rabbitmq_servers: 127.0.0.1 -magnum_rabbitmq_use_ssl: False -magnum_rabbitmq_port: 5672 +# Oslo Messaging vars +# RPC +magnum_oslomsg_rpc_transport: rabbit +magnum_oslomsg_rpc_servers: 127.0.0.1 +magnum_oslomsg_rpc_port: 5672 +magnum_oslomsg_rpc_use_ssl: False +magnum_oslomsg_rpc_userid: magnum +magnum_oslomsg_rpc_vhost: /magnum + +# Notify +magnum_oslomsg_notify_transport: rabbit +magnum_oslomsg_notify_servers: 127.0.0.1 +magnum_oslomsg_notify_port: 5672 +magnum_oslomsg_notify_use_ssl: False +magnum_oslomsg_notify_userid: magnum +magnum_oslomsg_notify_vhost: /magnum # Keystone AuthToken/Middleware magnum_keystone_auth_plugin: password diff --git a/doc/source/index.rst b/doc/source/index.rst index 9db85ac..47696c9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -40,11 +40,17 @@ To use this role, define the following variables: # Magnum Galera username magnum_galera_user: magnum - # Magnum rabbit userid - magnum_rabbitmq_userid: magnum + # Magnum rpc userid + magnum_oslomsg_rpc_userid: magnum - # Magnum rabbit vhost - magnum_rabbitmq_vhost: /magnum + # Magnum rpc vhost + magnum_oslomsg_rpc_vhost: /magnum + + # Magnum notify userid + magnum_oslomsg_notify_userid: magnum + + # Magnum notify vhost + magnum_oslomsg_notify_vhost: /magnum This list is not exhaustive. See role internals for further details. diff --git a/examples/playbook.yml b/examples/playbook.yml index b073a64..0a76a34 100644 --- a/examples/playbook.yml +++ b/examples/playbook.yml @@ -7,7 +7,9 @@ magnum_galera_address: "{{ internal_lb_vip_address }}" magnum_galera_database_name: magnum_service magnum_galera_user: magnum - magnum_rabbitmq_userid: magnum - magnum_rabbitmq_vhost: /magnum + magnum_oslomsg_rpc_userid: magnum + magnum_oslomsg_rpc_vhost: /magnum + magnum_oslomsg_notify_userid: magnum + magnum_oslomsg_notify_vhost: /magnum ansible_hostname: "{{ container_name }}" is_metal: "{{ properties.is_metal|default(false) }}" diff --git a/releasenotes/notes/oslo-messaging-separate-backends-a3af6957a984ac51.yaml b/releasenotes/notes/oslo-messaging-separate-backends-a3af6957a984ac51.yaml new file mode 100644 index 0000000..6aefd37 --- /dev/null +++ b/releasenotes/notes/oslo-messaging-separate-backends-a3af6957a984ac51.yaml @@ -0,0 +1,20 @@ +--- +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. + - magnum_oslomsg_rpc_servers replaces rabbitmq_servers + - magnum_oslomsg_rpc_port replaces rabbitmq_port + - magnum_oslomsg_rpc_userid replaces magnum_rabbitmq_userid + - magnum_oslomsg_rpc_vhost replaces magnum_rabbitmq_vhost + - added magnum_oslomsg_rpc_use_ssl + - added magnum_oslomsg_notify_servers + - added magnum_oslomsg_notify_port + - added magnum_oslomsg_notify_use_ssl + - added magnum_oslomsg_notify_userid + - added magnum_oslomsg_notify_vhost + - added magnum_oslomsg_notify_password diff --git a/templates/magnum.conf.j2 b/templates/magnum.conf.j2 index 6650571..bf8be6f 100644 --- a/templates/magnum.conf.j2 +++ b/templates/magnum.conf.j2 @@ -3,7 +3,7 @@ use_stderr = False debug = {{ debug }} host = {{ ansible_host }} -transport_url = rabbit://{% for host in magnum_rabbitmq_servers.split(',') %}{{ magnum_rabbitmq_userid }}:{{ magnum_rabbitmq_password }}@{{ host }}:{{ magnum_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ magnum_rabbitmq_vhost }}{% endif %}{% endfor %} +transport_url = {{ magnum_oslomsg_rpc_transport }}://{% for host in magnum_oslomsg_rpc_servers.split(',') %}{{ magnum_oslomsg_rpc_userid }}:{{ magnum_oslomsg_rpc_password }}@{{ host }}:{{ magnum_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ magnum_oslomsg_rpc_vhost }}{% if magnum_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [api] host = {{ ansible_host }} @@ -53,8 +53,11 @@ endpoint_type = internalURL [nova_client] endpoint_type = internalURL +[oslo_messaging_notifications] +transport_url = {{ magnum_oslomsg_notify_transport }}://{% for host in magnum_oslomsg_notify_servers.split(',') %}{{ magnum_oslomsg_notify_userid }}:{{ magnum_oslomsg_notify_password }}@{{ host }}:{{ magnum_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ magnum_oslomsg_notify_vhost }}{% if magnum_oslomsg_notify_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} + [oslo_messaging_rabbit] -ssl = {{ magnum_rabbitmq_use_ssl }} +ssl = {{ magnum_oslomsg_rpc_use_ssl }} rabbit_notification_exchange = magnum rabbit_notification_topic = notification diff --git a/tests/inventory b/tests/inventory index 7c974c2..4387910 100644 --- a/tests/inventory +++ b/tests/inventory @@ -9,6 +9,12 @@ storage1 infra1 openstack1 +[oslomsg_rpc_all] +infra1 + +[oslomsg_notify_all] +infra1 + [rabbitmq_all] infra1 diff --git a/tests/os_magnum-overrides.yml b/tests/os_magnum-overrides.yml index bfdde8f..f9a1365 100644 --- a/tests/os_magnum-overrides.yml +++ b/tests/os_magnum-overrides.yml @@ -3,11 +3,12 @@ magnum_developer_mode: true magnum_galera_password: secrete magnum_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" magnum_service_password: secrete -magnum_rabbitmq_password: secrete +magnum_oslomsg_rpc_password: secrete +magnum_oslomsg_notify_password: secrete magnum_trustee_password: secrete -magnum_rabbitmq_servers: "{{ rabbitmq_servers }}" -magnum_rabbitmq_userid: magnum -magnum_rabbitmq_vhost: /magnum +magnum_oslomsg_rpc_servers: "{{ rabbitmq_servers }}" +magnum_oslomsg_rpc_userid: magnum +magnum_oslomsg_rpc_vhost: /magnum magnum_galera_database_name: magnum_service magnum_galera_user: magnum diff --git a/tests/test-install-magnum.yml b/tests/test-install-magnum.yml index bb46ee1..1fe1287 100644 --- a/tests/test-install-magnum.yml +++ b/tests/test-install-magnum.yml @@ -17,10 +17,13 @@ hosts: magnum_all user: root pre_tasks: - - include: common/ensure-rabbitmq.yml - vhost_name: "{{ magnum_rabbitmq_vhost }}" - user_name: "{{ magnum_rabbitmq_userid }}" - user_password: "{{ magnum_rabbitmq_password }}" + - include: common/ensure-oslomsg.yml + rpc_vhost: "{{ magnum_oslomsg_rpc_vhost }}" + rpc_user: "{{ magnum_oslomsg_rpc_userid }}" + rpc_password: "{{ magnum_oslomsg_rpc_password }}" + notify_vhost: "{{ magnum_oslomsg_notify_vhost }}" + notify_user: "{{ magnum_oslomsg_notify_userid }}" + notify_password: "{{ magnum_oslomsg_notify_password }}" roles: - role: "os_magnum" vars_files: