Remove support for amqp1 messaging driver

It was deprecated during the 2023.2 cycle[1], so can be removed now.

Also add validation about transport_url options to reject unsupported
drivers.

[1] e174113210

Depends-on: https://review.opendev.org/918774
Change-Id: I3c3b17b8109c84cc0cbfb4254cc969cc563265e4
This commit is contained in:
Takashi Kajinami 2024-05-12 14:10:34 +09:00
parent f5b84cb0c5
commit b4872bf38b
13 changed files with 132 additions and 284 deletions

View File

@ -1,186 +0,0 @@
# == Define: oslo::messaging::amqp
#
# DEPRECATED !!
# Configure oslo_messaging_amqp options
#
# This resource configures Oslo messaging resources for an OpenStack service.
# It will manage the [oslo_messaging_amqp] section in the given config resource.
#
# === Parameters:
#
# [*addressing_mode*]
# (Optional) Indicates the addressing mode used by the driver
# Defaults to $facts['os_service_default'].
#
# [*server_request_prefix*]
# (Optional) Address prefix used when sending to a specific server
# Defaults to $facts['os_service_default'].
#
# [*broadcast_prefix*]
# (Optional) Address prefix used when broadcasting to all servers
# Defaults to $facts['os_service_default'].
#
# [*group_request_prefix*]
# (Optional) Address prefix when sending to any server in group
# Defaults to $facts['os_service_default'].
#
# [*rpc_address_prefix*]
# (Optional) Address prefix for all generated RPC addresses
# Defaults to $facts['os_service_default'].
#
# [*notify_address_prefix*]
# (Optional) Address prefix for all generated Notification addresses
# Defaults to $facts['os_service_default'].
#
# [*multicast_address*]
# (Optional) Appended to address prefix when sending fanout message
# Defaults to $facts['os_service_default'].
#
# [*unicast_address*]
# (Optional) Appended to address prefix when sending to a
# particular RPC/Notification server.
# Defaults to $facts['os_service_default'].
#
# [*anycast_address*]
# (Optional) Appended to address prefix when sending to a
# group of consumers.
# Defaults to $facts['os_service_default'].
#
# [*default_notification_exchange*]
# (Optional) Exchange name used in notification addresses
# Defaults to $facts['os_service_default'].
#
# [*default_rpc_exchange*]
# (Optional) Exchange name used in RPC addresses
# Defaults to $facts['os_service_default'].
#
# [*pre_settled*]
# (Optional) Send messages of this type pre-settled
# Defaults to $facts['os_service_default'].
#
# [*container_name*]
# (Optional) Name for the AMQP container
# Defaults to $facts['os_service_default'].
#
# [*idle_timeout*]
# (Optional) Timeout for inactive connections
# Defaults to $facts['os_service_default'].
#
# [*trace*]
# (Optional) Debug: dump AMQP frames to stdout
# Defaults to $facts['os_service_default'].
#
# [*ssl*]
# (Optional) Attempt to connect via SSL.
# Defaults to $facts['os_service_default'].
#
# [*ssl_ca_file*]
# (Optional) CA certificate PEM file to verify server certificate
# Defaults to $facts['os_service_default'].
#
# [*ssl_cert_file*]
# (Optional) Identifying certificate PEM file to present to clients
# Defaults to $facts['os_service_default'].
#
# [*ssl_key_file*]
# (Optional) Private key PEM file used to sign cert_file certificate
# Defaults to $facts['os_service_default'].
#
# [*ssl_key_password*]
# (Optional) Password for decrypting ssl_key_file (if encrypted)
# Defaults to $facts['os_service_default'].
#
# [*sasl_mechanisms*]
# (Optional) Space separated list of acceptable SASL mechanisms
# Defaults to $facts['os_service_default'].
#
# [*sasl_config_dir*]
# (Optional) Path to directory that contains the SASL configuration
# Defaults to $facts['os_service_default'].
#
# [*sasl_config_name*]
# (Optional) Name of configuration file (without .conf suffix)
# Defaults to $facts['os_service_default'].
#
# [*sasl_default_realm*]
# (Optional) SASL realm to use if not realm present in username
# Defaults to $facts['os_service_default'].
#
# [*username*]
# (Optional) User name for message broker authentication
# Defaults to $facts['os_service_default'].
#
# [*password*]
# (Optional) Password for message broker authentication
# Defaults to $facts['os_service_default'].
#
# [*default_send_timeout*]
# (Optional) The deadline for an rpc cast or call message delivery
# Defaults to $facts['os_service_default'].
#
# [*default_notify_timeout*]
# (Optional) The deadline for a sent notification message delivery
# Defaults to $facts['os_service_default'].
#
define oslo::messaging::amqp(
$addressing_mode = $facts['os_service_default'],
$server_request_prefix = $facts['os_service_default'],
$broadcast_prefix = $facts['os_service_default'],
$group_request_prefix = $facts['os_service_default'],
$rpc_address_prefix = $facts['os_service_default'],
$notify_address_prefix = $facts['os_service_default'],
$multicast_address = $facts['os_service_default'],
$unicast_address = $facts['os_service_default'],
$anycast_address = $facts['os_service_default'],
$default_notification_exchange = $facts['os_service_default'],
$default_rpc_exchange = $facts['os_service_default'],
$pre_settled = $facts['os_service_default'],
$container_name = $facts['os_service_default'],
$idle_timeout = $facts['os_service_default'],
$trace = $facts['os_service_default'],
$ssl = $facts['os_service_default'],
$ssl_ca_file = $facts['os_service_default'],
$ssl_cert_file = $facts['os_service_default'],
$ssl_key_file = $facts['os_service_default'],
$ssl_key_password = $facts['os_service_default'],
$sasl_mechanisms = $facts['os_service_default'],
$sasl_config_dir = $facts['os_service_default'],
$sasl_config_name = $facts['os_service_default'],
$sasl_default_realm = $facts['os_service_default'],
$username = $facts['os_service_default'],
$password = $facts['os_service_default'],
$default_send_timeout = $facts['os_service_default'],
$default_notify_timeout = $facts['os_service_default'],
){
$amqp_options={ 'oslo_messaging_amqp/addressing_mode' => { value => $addressing_mode },
'oslo_messaging_amqp/server_request_prefix' => { value => $server_request_prefix },
'oslo_messaging_amqp/broadcast_prefix' => { value => $broadcast_prefix },
'oslo_messaging_amqp/group_request_prefix' => { value => $group_request_prefix },
'oslo_messaging_amqp/rpc_address_prefix' => { value => $rpc_address_prefix },
'oslo_messaging_amqp/notify_address_prefix' => { value => $notify_address_prefix },
'oslo_messaging_amqp/multicast_address' => { value => $multicast_address },
'oslo_messaging_amqp/unicast_address' => { value => $unicast_address },
'oslo_messaging_amqp/anycast_address' => { value => $anycast_address },
'oslo_messaging_amqp/default_notification_exchange' => { value => $default_notification_exchange },
'oslo_messaging_amqp/default_rpc_exchange' => { value => $default_rpc_exchange },
'oslo_messaging_amqp/pre_settled' => { value => any2array($pre_settled) },
'oslo_messaging_amqp/container_name' => { value => $container_name },
'oslo_messaging_amqp/idle_timeout' => { value => $idle_timeout },
'oslo_messaging_amqp/trace' => { value => $trace },
'oslo_messaging_amqp/ssl' => { value => $ssl },
'oslo_messaging_amqp/ssl_ca_file' => { value => $ssl_ca_file },
'oslo_messaging_amqp/ssl_cert_file' => { value => $ssl_cert_file },
'oslo_messaging_amqp/ssl_key_file' => { value => $ssl_key_file },
'oslo_messaging_amqp/ssl_key_password' => { value => $ssl_key_password, secret => true },
'oslo_messaging_amqp/sasl_mechanisms' => { value => $sasl_mechanisms },
'oslo_messaging_amqp/sasl_config_dir' => { value => $sasl_config_dir },
'oslo_messaging_amqp/sasl_config_name' => { value => $sasl_config_name },
'oslo_messaging_amqp/sasl_default_realm' => { value => $sasl_default_realm },
'oslo_messaging_amqp/username' => { value => $username },
'oslo_messaging_amqp/password' => { value => $password, secret => true },
'oslo_messaging_amqp/default_send_timeout' => { value => $default_send_timeout },
'oslo_messaging_amqp/default_notify_timeout' => { value => $default_notify_timeout },
}
create_resources($name, $amqp_options)
}

View File

@ -31,16 +31,12 @@
#
define oslo::messaging::default(
$executor_thread_pool_size = $facts['os_service_default'],
$rpc_response_timeout = $facts['os_service_default'],
$transport_url = $facts['os_service_default'],
$control_exchange = $facts['os_service_default'],
$executor_thread_pool_size = $facts['os_service_default'],
$rpc_response_timeout = $facts['os_service_default'],
Oslo::TransportURL $transport_url = $facts['os_service_default'],
$control_exchange = $facts['os_service_default'],
) {
if $transport_url =~ 'amqp://.+' {
warning('amqp1 driver support has been deprecated, because the driver is deprecated.')
}
$default_options = {
'DEFAULT/executor_thread_pool_size' => { value => $executor_thread_pool_size },
'DEFAULT/rpc_response_timeout' => { value => $rpc_response_timeout },

View File

@ -33,16 +33,12 @@
# Defaults to $facts['os_service_default'].
#
define oslo::messaging::notifications(
$driver = $facts['os_service_default'],
$transport_url = $facts['os_service_default'],
$topics = $facts['os_service_default'],
$retry = $facts['os_service_default'],
$driver = $facts['os_service_default'],
Oslo::TransportURL $transport_url = $facts['os_service_default'],
$topics = $facts['os_service_default'],
$retry = $facts['os_service_default'],
) {
if $transport_url =~ 'amqp://.+' {
warning('amqp1 driver support has been deprecated, because the driver is deprecated.')
}
# When we have a string value for driver, we keep passing it as string
# to reduce any chance of breaking things in a backwards incompatible way
$driver_real = $driver ? {

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
Support for amqp1 messaging driver has been removed.

View File

@ -1,78 +0,0 @@
require 'spec_helper'
describe 'oslo::messaging::amqp' do
let (:title) { 'keystone_config' }
shared_examples 'oslo-messaging-amqp' do
context 'with default parameters' do
it 'configure oslo_messaging_amqp default params' do
is_expected.to contain_keystone_config('oslo_messaging_amqp/addressing_mode').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/rpc_address_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/notify_address_prefix').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/multicast_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/unicast_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/anycast_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/default_notification_exchange').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/default_rpc_exchange').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/pre_settled').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_keystone_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/idle_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/trace').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_default_realm').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_keystone_config('oslo_messaging_amqp/default_send_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_amqp/default_notify_timeout').with_value('<SERVICE DEFAULT>')
end
end
context 'with overridden parameters' do
let :params do
{ :idle_timeout => 2000,
:container_name => 'openstack',
:username => 'newuser',
:password => 'p@ssw0rd',
:pre_settled => ['rpc-cast','rpc-reply','notify'],
:ssl => true,
:sasl_default_realm => 'overcloud-1'
}
end
it 'configure oslo_messaging_amqp with overridden values' do
is_expected.to contain_keystone_config('oslo_messaging_amqp/idle_timeout').with_value(2000)
is_expected.to contain_keystone_config('oslo_messaging_amqp/container_name').with_value('openstack')
is_expected.to contain_keystone_config('oslo_messaging_amqp/username').with_value('newuser')
is_expected.to contain_keystone_config('oslo_messaging_amqp/password').with_value('p@ssw0rd').with_secret(true)
is_expected.to contain_keystone_config('oslo_messaging_amqp/pre_settled').with_value(['rpc-cast','rpc-reply','notify'])
is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_default_realm').with_value('overcloud-1')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'oslo-messaging-amqp'
end
end
end

View File

@ -21,7 +21,7 @@ describe 'oslo::messaging::default' do
{
:executor_thread_pool_size => '64',
:rpc_response_timeout => '42',
:transport_url => 'proto://url',
:transport_url => 'fake://',
:control_exchange => 'openstack',
}
end
@ -29,7 +29,7 @@ describe 'oslo::messaging::default' do
it 'configure DEFAULT with overridden values' do
is_expected.to contain_keystone_config('DEFAULT/executor_thread_pool_size').with_value('64')
is_expected.to contain_keystone_config('DEFAULT/rpc_response_timeout').with_value('42')
is_expected.to contain_keystone_config('DEFAULT/transport_url').with_value('proto://url').with_secret(true)
is_expected.to contain_keystone_config('DEFAULT/transport_url').with_value('fake://').with_secret(true)
is_expected.to contain_keystone_config('DEFAULT/control_exchange').with_value('openstack')
end
end

View File

@ -19,7 +19,7 @@ describe 'oslo::messaging::notifications' do
context 'with overridden parameters' do
let :params do
{ :driver => ['messaging', 'messagingv2'],
:transport_url => 'some_protocol://some_url',
:transport_url => 'fake://',
:topics => ['foo', 'baa'],
:retry => -1,
}
@ -27,7 +27,7 @@ describe 'oslo::messaging::notifications' do
it 'configure oslo_messaging_notifications with overridden values' do
is_expected.to contain_keystone_config('oslo_messaging_notifications/driver').with_value(['messaging', 'messagingv2'])
is_expected.to contain_keystone_config('oslo_messaging_notifications/transport_url').with_value('some_protocol://some_url').with_secret(true)
is_expected.to contain_keystone_config('oslo_messaging_notifications/transport_url').with_value('fake://').with_secret(true)
is_expected.to contain_keystone_config('oslo_messaging_notifications/topics').with_value('foo,baa')
is_expected.to contain_keystone_config('oslo_messaging_notifications/retry').with_value(-1)
end

View File

@ -0,0 +1,34 @@
require 'spec_helper'
describe 'Oslo::TransportURL::Fake' do
describe 'valid types' do
context 'with valid types' do
[
'fake://'
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
end
describe 'invalid types' do
context 'with garbage inputs' do
[
'fakes://',
'afake://',
'fake://host',
'fake:/',
'fake:///',
'rabbit://rabbit_user:password@localhost:5673',
'<SERVICE DEFAULT>',
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end

View File

@ -0,0 +1,40 @@
require 'spec_helper'
describe 'Oslo::TransportURL::Rabbit' do
describe 'valid types' do
context 'with valid types' do
[
'rabbit://rabbit_user:password@localhost:5673',
'kombu://rabbit_user:password@localhost:5673',
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
end
describe 'invalid types' do
context 'with garbage inputs' do
[
'rabbits://rabbit_user:password@localhost:5673',
'arabbit://rabbit_user:password@localhost:5673',
'rabbit:/rabbit_user:password@localhost:5673',
'rabbit:///rabbit_user:password@localhost:5673',
'rabbit://',
'kombus://rabbit_user:password@localhost:5673',
'akombu://rabbit_user:password@localhost:5673',
'kombu:/rabbit_user:password@localhost:5673',
'kombu:///rabbit_user:password@localhost:5673',
'kombu://',
'fake://',
'<SERVICE DEFAULT>',
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end

View File

@ -0,0 +1,31 @@
require 'spec_helper'
describe 'Oslo::TransportURL' do
describe 'valid types' do
context 'with valid types' do
[
'rabbit://rabbit_user:password@localhost:5673',
'kombu://rabbit_user:password@localhost:5673',
'fake://',
'<SERVICE DEFAULT>',
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
end
describe 'invalid types' do
context 'with garbage inputs' do
[
'amqp://amqp_user:password@localhost:5672',
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end

5
types/transporturl.pp Normal file
View File

@ -0,0 +1,5 @@
type Oslo::TransportURL = Variant[
Oslo::TransportURL::Rabbit,
Oslo::TransportURL::Fake,
Openstacklib::Servicedefault,
]

View File

@ -0,0 +1,3 @@
type Oslo::TransportURL::Fake = Pattern[
/^(fake):\/\/$/
]

View File

@ -0,0 +1,3 @@
type Oslo::TransportURL::Rabbit = Pattern[
/^(rabbit|kombu):\/\/[^\/].*/
]