Merge "Introduce node name prefix for mgmt/messaging IPs"
This commit is contained in:
commit
c6a0f09811
@ -291,6 +291,8 @@ if hiera('amqp_hosts', false) {
|
||||
$amqp_hosts = amqp_hosts($amqp_nodes, $amqp_port, get_network_role_property('mgmt/messaging', 'ipaddr'))
|
||||
}
|
||||
|
||||
$node_name_prefix_for_messaging = hiera('node_name_prefix_for_messaging', 'messaging-')
|
||||
|
||||
# MySQL and SQLAlchemy backend configuration
|
||||
$custom_mysql_setup_class = hiera('custom_mysql_setup_class', 'galera')
|
||||
$max_pool_size = hiera('max_pool_size', min($::processorcount * 5 + 0, 30 + 0))
|
||||
|
@ -1,12 +1,14 @@
|
||||
notice('MODULAR: hosts.pp')
|
||||
|
||||
$hosts_file = '/etc/hosts'
|
||||
$host_resources = network_metadata_to_hosts(hiera_hash('network_metadata'))
|
||||
$network_metadata = hiera_hash('network_metadata')
|
||||
$host_resources = network_metadata_to_hosts($network_metadata)
|
||||
$messaging_host_resources = network_metadata_to_hosts($network_metadata, 'mgmt/messaging', hiera('node_name_prefix_for_messaging'))
|
||||
|
||||
Host {
|
||||
ensure => present,
|
||||
target => $hosts_file
|
||||
}
|
||||
|
||||
create_resources(host, $host_resources)
|
||||
create_resources(host, merge($host_resources, $messaging_host_resources))
|
||||
|
||||
|
@ -49,6 +49,7 @@ if $queue_provider == 'rabbitmq' {
|
||||
$management_bind_ip_address = hiera('management_bind_ip_address', '127.0.0.1')
|
||||
$enable_rpc_ha = hiera('enable_rpc_ha', 'true')
|
||||
$enable_notifications_ha = hiera('enable_notifications_ha', 'true')
|
||||
$fqdn_prefix = hiera('node_name_prefix_for_messaging', 'messaging-')
|
||||
|
||||
# NOTE(mattymo) UNSET is a puppet ref, but would break real configs
|
||||
if $rabbitmq_bind_ip_address == 'UNSET' {
|
||||
@ -103,13 +104,14 @@ if $queue_provider == 'rabbitmq' {
|
||||
} else {
|
||||
$rabbit_pid_file = '/var/run/rabbitmq/pid'
|
||||
}
|
||||
$environment_variables = hiera('rabbit_environment_variables',
|
||||
$environment_variables_init = hiera('rabbit_environment_variables',
|
||||
{
|
||||
'SERVER_ERL_ARGS' => "\"+K true +A${thread_pool_calc} +P 1048576\"",
|
||||
'ERL_EPMD_ADDRESS' => $epmd_bind_ip_address,
|
||||
'PID_FILE' => $rabbit_pid_file,
|
||||
}
|
||||
)
|
||||
$environment_variables = merge($environment_variables_init,{'NODENAME' => "rabbit@${fqdn_prefix}${hostname}"})
|
||||
|
||||
if ($enabled) {
|
||||
class { '::rabbitmq':
|
||||
@ -165,6 +167,7 @@ if $queue_provider == 'rabbitmq' {
|
||||
before => Class['nova::rabbitmq'],
|
||||
enable_rpc_ha => $enable_rpc_ha,
|
||||
enable_notifications_ha => $enable_notifications_ha,
|
||||
fqdn_prefix => $fqdn_prefix,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,5 +123,6 @@ if @vips.select{|key, hash| hash['namespace'] == 'haproxy' }.length == 0
|
||||
else
|
||||
globals.store "external_lb", false
|
||||
end -%>
|
||||
<% globals.store "node_name_prefix_for_messaging", @node_name_prefix_for_messaging -%>
|
||||
|
||||
<%= YAML.dump globals %>
|
||||
|
@ -58,6 +58,11 @@
|
||||
# Boolean. Set ha-mode=all policy for Ceilometer queues. Note
|
||||
# that RPC queues are not affected by this flag.
|
||||
#
|
||||
# [*fqdn_prefix*]
|
||||
# String. Optional FQDN prefix for node names.
|
||||
# Defaults to empty string
|
||||
#
|
||||
|
||||
class pacemaker_wrappers::rabbitmq (
|
||||
$primitive_type = 'rabbitmq-server',
|
||||
$service_name = $::rabbitmq::service_name,
|
||||
@ -71,6 +76,7 @@ class pacemaker_wrappers::rabbitmq (
|
||||
$admin_pass = undef,
|
||||
$enable_rpc_ha = true,
|
||||
$enable_notifications_ha = true,
|
||||
$fqdn_prefix = '',
|
||||
) inherits ::rabbitmq::service {
|
||||
|
||||
if $host_ip == 'UNSET' or $host_ip == '0.0.0.0' {
|
||||
@ -89,6 +95,7 @@ class pacemaker_wrappers::rabbitmq (
|
||||
'admin_password' => $admin_pass,
|
||||
'enable_rpc_ha' => $enable_rpc_ha,
|
||||
'enable_notifications_ha' => $enable_notifications_ha,
|
||||
'fqdn_prefix' => $fqdn_prefix,
|
||||
}
|
||||
|
||||
$metadata = {
|
||||
|
@ -44,6 +44,7 @@ OCF_RESKEY_node_port_default=5672
|
||||
OCF_RESKEY_erlang_cookie_default=false
|
||||
OCF_RESKEY_erlang_cookie_file_default="/var/lib/rabbitmq/.erlang.cookie"
|
||||
OCF_RESKEY_use_fqdn_default=false
|
||||
OCF_RESKEY_fqdn_prefix_default=""
|
||||
OCF_RESKEY_max_rabbitmqctl_timeouts_default=1
|
||||
|
||||
: ${HA_LOGTAG="lrmd"}
|
||||
@ -63,6 +64,7 @@ OCF_RESKEY_max_rabbitmqctl_timeouts_default=1
|
||||
: ${OCF_RESKEY_erlang_cookie=${OCF_RESKEY_erlang_cookie_default}}
|
||||
: ${OCF_RESKEY_erlang_cookie_file=${OCF_RESKEY_erlang_cookie_file_default}}
|
||||
: ${OCF_RESKEY_use_fqdn=${OCF_RESKEY_use_fqdn_default}}
|
||||
: ${OCF_RESKEY_fqdn_prefix=${OCF_RESKEY_fqdn_prefix_default}}
|
||||
: ${OCF_RESKEY_max_rabbitmqctl_timeouts=${OCF_RESKEY_max_rabbitmqctl_timeouts_default}}
|
||||
|
||||
#######################################################################
|
||||
@ -266,6 +268,16 @@ Either to use FQDN or a shortname for the rabbitmq node
|
||||
<content type="boolean" default="${OCF_RESKEY_use_fqdn_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="fqdn_prefix" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Optional FQDN prefix for RabbitMQ nodes in cluster.
|
||||
FQDN prefix can be specified to host multiple RabbitMQ instances on a node or
|
||||
in case of RabbitMQ running in dedicated network/interface.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">FQDN prefix</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_fqdn_prefix_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="max_rabbitmqctl_timeouts" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
If during monitor call rabbitmqctl times out, the timeout is ignored
|
||||
@ -515,9 +527,9 @@ get_hostname() {
|
||||
# Strip the FQDN to the shortname, if OCF_RESKEY_use_fqdn was set
|
||||
process_fqdn() {
|
||||
if [ "${OCF_RESKEY_use_fqdn}" = 'false' ] ; then
|
||||
echo "$1" | awk -F. '{print $1}'
|
||||
echo "${OCF_RESKEY_fqdn_prefix}$1" | awk -F. '{print $1}'
|
||||
else
|
||||
echo "$1"
|
||||
echo "${OCF_RESKEY_fqdn_prefix}$1"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -530,7 +542,7 @@ my_host() {
|
||||
local rc=10
|
||||
local LH="${LL} my_host():"
|
||||
|
||||
hostname=$(get_hostname)
|
||||
hostname=$(process_fqdn $(get_hostname))
|
||||
ocf_log info "${LH} hostlist is: $hostlist"
|
||||
for host in $hostlist ; do
|
||||
hn=$(process_fqdn "${host}")
|
||||
|
@ -920,3 +920,4 @@ workloads_collector:
|
||||
password: MhdNr1K7
|
||||
tenant: services
|
||||
username: workloads_collector
|
||||
node_name_prefix_for_messaging: rabbitmq
|
||||
|
@ -3,6 +3,32 @@ require 'shared-examples'
|
||||
manifest = 'hosts/hosts.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
|
||||
network_metadata = Noop.hiera_structure('network_metadata/nodes')
|
||||
messaging_fqdn_prefix = Noop.hiera('node_name_prefix_for_messaging', 'messaging-')
|
||||
|
||||
it 'should create basic host entries' do
|
||||
network_metadata.each do |node, params|
|
||||
should contain_host(params['fqdn']).with({
|
||||
:ip => params['network_roles']['mgmt/vip'],
|
||||
:host_aliases => ["#{node}"],
|
||||
:target => '/etc/hosts'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
it 'should create host entries for messaging network with correct prefix' do
|
||||
network_metadata.each do |node, params|
|
||||
should contain_host("#{messaging_fqdn_prefix}#{params['fqdn']}").with({
|
||||
:ip => params['network_roles']['mgmt/messaging'],
|
||||
:host_aliases => ["#{messaging_fqdn_prefix}#{node}"],
|
||||
:target => '/etc/hosts'
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
||||
|
@ -16,6 +16,13 @@ describe manifest do
|
||||
expect(environment_variables['ERL_EPMD_ADDRESS']).to eq node_ip_address
|
||||
end
|
||||
|
||||
it "should contain nodename" do
|
||||
fqdn_prefix = Noop.hiera('node_name_prefix_for_messaging', 'messaging-')
|
||||
node_name = "rabbit@#{fqdn_prefix}#{facts[:hostname]}"
|
||||
environment_variables = Noop.resource_parameter_value self, 'class', 'rabbitmq', 'environment_variables'
|
||||
expect(environment_variables['NODENAME']).to eq node_name
|
||||
end
|
||||
|
||||
# LP#1477595
|
||||
it "should contain rabbitmq correct log levels" do
|
||||
debug = Noop.hiera('debug', false)
|
||||
@ -54,6 +61,7 @@ describe manifest do
|
||||
it "should override service on package install" do
|
||||
should contain_tweaks__ubuntu_service_override('rabbitmq-server')
|
||||
end
|
||||
|
||||
end
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user