inspector: Support oslo.messaging options

The ironic-inspector service has api workers and rpc workers and these
communicate over rabbitmq.

Closes-Bug: #2043931
Change-Id: I759c856d9f19c970390a10ca3b19ba0458190203
This commit is contained in:
Takashi Kajinami 2023-11-20 02:34:03 +09:00
parent 029df239fc
commit 6dd89d34a5
3 changed files with 260 additions and 30 deletions

View File

@ -178,12 +178,6 @@
# (optional) Boolean value to determine if ppc64le support should be enabled
# Defaults to false (no ppc64le support)
#
# [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:F
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to 'fake://'
#
# [*port_physnet_cidr_map*]
# (optional) Hash where key's are CIDR and values are physical network.
# Mapping of IP subnet CIDR to physical network. When the
@ -198,6 +192,120 @@
# driver.
# Defaults to $::ironic::parmas::uefi_ipxe_bootfile_name
#
# [*executor_thread_pool_size*]
# (optional) Size of executor thread pool when executor is threading or eventlet.
# Defaults to $facts['os_service_default'].
#
# [*rpc_response_timeout*]
# (optional) Seconds to wait for a response from a call. (integer value)
# Defaults to $facts['os_service_default'].
#
# [*rpc_transport*]
# (optional) Defines a remote procedure call transport between conductor and
# API processes, such as using a messaging broker or JSON RPC.
# Defaults to $facts['os_service_default']
#
# [*control_exchange*]
# (optional) What RPC queue/exchange to use (string value)
# Defaults to $facts['os_service_default']
#
# [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to 'fake://'
#
# [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ. (boolean value)
# Defaults to $facts['os_service_default']
#
# [*rabbit_ha_queues*]
# (optional) Use HA queues in RabbitMQ. (boolean value)
# Defaults to $facts['os_service_default']
#
# [*rabbit_heartbeat_timeout_threshold*]
# (optional) Number of seconds after which the RabbitMQ broker is considered
# down if the heartbeat keepalive fails. Any value >0 enables heartbeats.
# Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently
# closed, resulting in missed or lost messages from the queue.
# Requires kombu >= 3.0.7 and amqp >= 1.4.0. (integer value)
# Defaults to $facts['os_service_default']
#
# [*rabbit_heartbeat_rate*]
# (optional) How often during the rabbit_heartbeat_timeout_threshold period
# to check the heartbeat on RabbitMQ connection.
# i.e. rabbit_heartbeat_rate=2 when rabbit_heartbeat_timeout_threshold=60,
# the heartbeat will be checked every 30 seconds. (integer value)
# Defaults to $facts['os_service_default']
#
# [*rabbit_heartbeat_in_pthread*]
# (Optional) EXPERIMENTAL: Run the health check heartbeat thread
# through a native python thread. By default if this
# option isn't provided the health check heartbeat will
# inherit the execution model from the parent process. By
# example if the parent process have monkey patched the
# stdlib by using eventlet/greenlet then the heartbeat
# will be run through a green thread.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_queue*]
# (Optional) Use quorum queues in RabbitMQ.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_delivery_limit*]
# (Optional) Each time a message is rdelivered to a consumer, a counter is
# incremented. Once the redelivery count exceeds the delivery limit
# the message gets dropped or dead-lettered.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_max_memory_length*]
# (Optional) Limit the number of messages in the quorum queue.
# Defaults to $facts['os_service_default']
#
# [*rabbit_quorum_max_memory_bytes*]
# (Optional) Limit the number of memory bytes used by the quorum queue.
# Defaults to $facts['os_service_default']
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# (string value)
# Defaults to $facts['os_service_default']
#
# [*kombu_ssl_certfile*]
# (optional) SSL cert file (valid only if SSL enabled). (string value)
# Defaults to $facts['os_service_default']
#
# [*kombu_ssl_keyfile*]
# (optional) SSL key file (valid only if SSL enabled). (string value)
# Defaults to $facts['os_service_default']
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions. (string value)
# Defaults to $facts['os_service_default']
#
# [*kombu_reconnect_delay*]
# (optional) How long to wait before reconnecting in response to an AMQP
# consumer cancel notification. (floating point value)
# Defaults to $facts['os_service_default']
#
# [*kombu_failover_strategy*]
# (Optional) Determines how the next RabbitMQ node is chosen in case the one
# we are currently connected to becomes unavailable. Takes effect only if
# more than one RabbitMQ node is provided in config. (string value)
# Defaults to $facts['os_service_default']
#
# [*kombu_compression*]
# (optional) Possible values are: gzip, bz2. If not set compression will not
# be used. This option may notbe available in future versions. EXPERIMENTAL.
# (string value)
# Defaults to $facts['os_service_default']
#
# [*amqp_durable_queues*]
# (optional) Define queues as "durable" to rabbitmq. (boolean value)
# Defaults to $facts['os_service_default']
#
class ironic::inspector (
$package_ensure = 'present',
Boolean $manage_service = true,
@ -233,9 +341,30 @@ class ironic::inspector (
$node_not_found_hook = $facts['os_service_default'],
$discovery_default_driver = $facts['os_service_default'],
Boolean $enable_ppc64le = false,
$default_transport_url = 'fake://',
Hash $port_physnet_cidr_map = {},
$uefi_ipxe_bootfile_name = $::ironic::params::uefi_ipxe_bootfile_name,
$control_exchange = $facts['os_service_default'],
$executor_thread_pool_size = $facts['os_service_default'],
$rpc_response_timeout = $facts['os_service_default'],
$rpc_transport = $facts['os_service_default'],
$default_transport_url = 'fake://',
$rabbit_use_ssl = $facts['os_service_default'],
$rabbit_heartbeat_timeout_threshold = $facts['os_service_default'],
$rabbit_heartbeat_rate = $facts['os_service_default'],
$rabbit_heartbeat_in_pthread = $facts['os_service_default'],
$rabbit_ha_queues = $facts['os_service_default'],
$rabbit_quorum_queue = $facts['os_service_default'],
$rabbit_quorum_delivery_limit = $facts['os_service_default'],
$rabbit_quorum_max_memory_length = $facts['os_service_default'],
$rabbit_quorum_max_memory_bytes = $facts['os_service_default'],
$kombu_ssl_ca_certs = $facts['os_service_default'],
$kombu_ssl_certfile = $facts['os_service_default'],
$kombu_ssl_keyfile = $facts['os_service_default'],
$kombu_ssl_version = $facts['os_service_default'],
$kombu_reconnect_delay = $facts['os_service_default'],
$kombu_failover_strategy = $facts['os_service_default'],
$kombu_compression = $facts['os_service_default'],
$amqp_durable_queues = $facts['os_service_default'],
) inherits ironic::params {
include ironic::deps
@ -325,7 +454,6 @@ class ironic::inspector (
'DEFAULT/listen_address': value => $listen_address;
'DEFAULT/auth_strategy': value => $auth_strategy;
'DEFAULT/timeout': value => $timeout;
'DEFAULT/transport_url': value => $default_transport_url;
'DEFAULT/api_max_limit': value => $api_max_limit;
'capabilities/boot_mode': value => $detect_boot_mode;
'iptables/dnsmasq_interface': value => $dnsmasq_interface;
@ -342,6 +470,33 @@ class ironic::inspector (
'port_physnet/cidr_map': value => $port_physnet_cidr_map_real;
}
oslo::messaging::default {'ironic_inspector_config':
executor_thread_pool_size => $executor_thread_pool_size,
transport_url => $default_transport_url,
rpc_response_timeout => $rpc_response_timeout,
control_exchange => $control_exchange,
}
oslo::messaging::rabbit {'ironic_inspector_config':
rabbit_use_ssl => $rabbit_use_ssl,
heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
heartbeat_rate => $rabbit_heartbeat_rate,
heartbeat_in_pthread => $rabbit_heartbeat_in_pthread,
kombu_reconnect_delay => $kombu_reconnect_delay,
kombu_failover_strategy => $kombu_failover_strategy,
amqp_durable_queues => $amqp_durable_queues,
kombu_compression => $kombu_compression,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
rabbit_ha_queues => $rabbit_ha_queues,
rabbit_quorum_queue => $rabbit_quorum_queue,
rabbit_quorum_delivery_limit => $rabbit_quorum_delivery_limit,
rabbit_quorum_max_memory_length => $rabbit_quorum_max_memory_length,
rabbit_quorum_max_memory_bytes => $rabbit_quorum_max_memory_bytes,
}
if $dnsmasq_interface != 'br-ctlplane' {
warning("The [pxe] dnsmasq_interface option may not be configured by this class \
in a future release. Make sure the ironic::inspector::pxe_filter::iptables class is \

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``ironic::inspector`` class now supports configuring the oslo.messaging
library options.

View File

@ -114,7 +114,6 @@ describe 'ironic::inspector' do
is_expected.to contain_ironic_inspector_config('DEFAULT/listen_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('DEFAULT/auth_strategy').with_value(p[:auth_strategy])
is_expected.to contain_ironic_inspector_config('DEFAULT/timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('DEFAULT/transport_url').with_value('fake://')
is_expected.to contain_ironic_inspector_config('DEFAULT/api_max_limit').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('capabilities/boot_mode').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('iptables/dnsmasq_interface').with_value(p[:dnsmasq_interface])
@ -127,6 +126,33 @@ describe 'ironic::inspector' do
is_expected.to contain_ironic_inspector_config('processing/node_not_found_hook').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_inspector_config('port_physnet/cidr_map').with_value('')
is_expected.to contain_oslo__messaging__default('ironic_inspector_config').with(
:executor_thread_pool_size => '<SERVICE DEFAULT>',
:transport_url => 'fake://',
:rpc_response_timeout => '<SERVICE DEFAULT>',
:control_exchange => '<SERVICE DEFAULT>'
)
is_expected.to contain_oslo__messaging__rabbit('ironic_inspector_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
:heartbeat_rate => '<SERVICE DEFAULT>',
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
:kombu_failover_strategy => '<SERVICE DEFAULT>',
:amqp_durable_queues => '<SERVICE DEFAULT>',
:kombu_compression => '<SERVICE DEFAULT>',
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_version => '<SERVICE DEFAULT>',
:rabbit_ha_queues => '<SERVICE DEFAULT>',
:rabbit_quorum_queue => '<SERVICE DEFAULT>',
:rabbit_quorum_delivery_limit => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_length => '<SERVICE DEFAULT>',
:rabbit_quorum_max_memory_bytes => '<SERVICE DEFAULT>',
)
end
it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do
@ -189,27 +215,47 @@ describe 'ironic::inspector' do
context 'when overriding parameters' do
before :each do
params.merge!(
:dhcp_debug => true,
:listen_address => '127.0.0.1',
:api_max_limit => 100,
:pxe_transfer_protocol => 'http',
:additional_processing_hooks => 'hook1,hook2',
:ramdisk_collectors => 'default',
:ramdisk_kernel_args => 'foo=bar',
:http_port => 3816,
:tftp_root => '/var/lib/tftpboot',
:http_root => '/var/www/httpboot',
:detect_boot_mode => true,
:node_not_found_hook => 'enroll',
:discovery_default_driver => 'pxe_ipmitool',
:dnsmasq_ip_subnets => [{'ip_range' => '192.168.0.100,192.168.0.120'}],
:dnsmasq_dhcp_sequential_ip => false,
:dnsmasq_log_facility => '/var/log/ironic-inspector/dnsmasq.log',
:add_ports => 'all',
:always_store_ramdisk_logs => true,
:port_physnet_cidr_map => {'192.168.20.0/24' => 'physnet_a',
'2001:db8::/64' => 'physnet_b'},
:uefi_ipxe_bootfile_name => 'otherpxe.efi',
:dhcp_debug => true,
:listen_address => '127.0.0.1',
:api_max_limit => 100,
:pxe_transfer_protocol => 'http',
:additional_processing_hooks => 'hook1,hook2',
:ramdisk_collectors => 'default',
:ramdisk_kernel_args => 'foo=bar',
:http_port => 3816,
:tftp_root => '/var/lib/tftpboot',
:http_root => '/var/www/httpboot',
:detect_boot_mode => true,
:node_not_found_hook => 'enroll',
:discovery_default_driver => 'pxe_ipmitool',
:dnsmasq_ip_subnets => [{'ip_range' => '192.168.0.100,192.168.0.120'}],
:dnsmasq_dhcp_sequential_ip => false,
:dnsmasq_log_facility => '/var/log/ironic-inspector/dnsmasq.log',
:add_ports => 'all',
:always_store_ramdisk_logs => true,
:port_physnet_cidr_map => {'192.168.20.0/24' => 'physnet_a',
'2001:db8::/64' => 'physnet_b'},
:uefi_ipxe_bootfile_name => 'otherpxe.efi',
:executor_thread_pool_size => '128',
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:rpc_response_timeout => '30',
:control_exchange => 'inspector',
:rabbit_use_ssl => true,
:rabbit_heartbeat_timeout_threshold => '60',
:rabbit_heartbeat_rate => '10',
:rabbit_heartbeat_in_pthread => true,
:kombu_reconnect_delay => '5.0',
:amqp_durable_queues => true,
:kombu_compression => 'gzip',
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_keyfile => '/etc/key',
:kombu_ssl_version => 'TLSv1',
:rabbit_ha_queues => true,
:rabbit_quorum_queue => true,
:rabbit_quorum_delivery_limit => 3,
:rabbit_quorum_max_memory_length => 5,
:rabbit_quorum_max_memory_bytes => 1073741824,
)
end
it 'should replace default parameter with new value' do
@ -222,6 +268,30 @@ describe 'ironic::inspector' do
is_expected.to contain_ironic_inspector_config('discovery/enroll_node_driver').with_value('pxe_ipmitool')
is_expected.to contain_ironic_inspector_config('processing/always_store_ramdisk_logs').with_value(true)
is_expected.to contain_ironic_inspector_config('port_physnet/cidr_map').with_value('192.168.20.0/24:physnet_a,2001:db8::/64:physnet_b')
is_expected.to contain_oslo__messaging__default('ironic_inspector_config').with(
:executor_thread_pool_size => '128',
:transport_url => 'rabbit://rabbit_user:password@localhost:5673',
:rpc_response_timeout => '30',
:control_exchange => 'inspector',
)
is_expected.to contain_oslo__messaging__rabbit('ironic_inspector_config').with(
:rabbit_use_ssl => true,
:heartbeat_timeout_threshold => '60',
:heartbeat_rate => '10',
:heartbeat_in_pthread => true,
:kombu_reconnect_delay => '5.0',
:amqp_durable_queues => true,
:kombu_compression => 'gzip',
:kombu_ssl_ca_certs => '/etc/ca.cert',
:kombu_ssl_certfile => '/etc/certfile',
:kombu_ssl_keyfile => '/etc/key',
:kombu_ssl_version => 'TLSv1',
:rabbit_ha_queues => true,
:rabbit_quorum_queue => true,
:rabbit_quorum_delivery_limit => 3,
:rabbit_quorum_max_memory_length => 5,
:rabbit_quorum_max_memory_bytes => 1073741824,
)
end
it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do