Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion chef/cookbooks/ceilometer/recipes/central_ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# Avoid races when creating pacemaker resources
crowbar_pacemaker_sync_mark "wait-ceilometer_central_ha_resources"

rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []

service_name = "ceilometer-central"
Expand All @@ -43,7 +44,7 @@
end

crowbar_pacemaker_order_only_existing "o-#{service_name}" do
ordering ["rabbitmq", "cl-keystone", service_name]
ordering ["#{rabbit_settings[:pacemaker_resource]}", "cl-keystone", service_name]
score "Optional"
action :create
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Expand Down
3 changes: 2 additions & 1 deletion chef/cookbooks/ceilometer/recipes/server_ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# Avoid races when creating pacemaker resources
crowbar_pacemaker_sync_mark "wait-ceilometer_server_ha_resources"

rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []
primitives = []

Expand Down Expand Up @@ -66,7 +67,7 @@
end
transaction_objects << "pacemaker_clone[#{clone_name}]"

order_only_existing = ["rabbitmq", "cl-keystone", clone_name]
order_only_existing = ["#{rabbit_settings[:pacemaker_resource]}", "cl-keystone", clone_name]

if node[:ceilometer][:use_mongodb]
pacemaker_order "o-ceilometer-mongo" do
Expand Down
12 changes: 12 additions & 0 deletions chef/cookbooks/ceilometer/templates/default/ceilometer.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ use_stderr = false
# A URL representing the messaging driver to use and its full
# configuration. If not set, we fall back to the rpc_backend option
# and driver specific configuration. (string value)
<% if @rabbit_settings['use_legacy_configuration'] -%>
#transport_url = <None>
<% else -%>
transport_url = <%= @rabbit_settings[:url] %>
<% end -%>

# The messaging driver to use, defaults to rabbit. Other drivers
# include qpid and zmq. (string value)
Expand Down Expand Up @@ -1168,7 +1172,11 @@ lock_path = /var/run/ceilometer
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_durable_queues
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#amqp_durable_queues = false
<% else -%>
amqp_durable_queues = <%= @rabbit_settings[:durable_queues] %>
<% end -%>

# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
Expand Down Expand Up @@ -1269,7 +1277,11 @@ rabbit_virtual_host = <%= @rabbit_settings[:vhost] %>
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
# option, you must wipe the RabbitMQ database. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_ha_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#rabbit_ha_queues = false
<% else -%>
rabbit_ha_queues = <%= @rabbit_settings[:ha_queues] %>
<% end -%>

# Number of seconds after which the Rabbit broker is considered down
# if heartbeat's keep-alive fails (0 disable the heartbeat).
Expand Down
3 changes: 2 additions & 1 deletion chef/cookbooks/cinder/recipes/controller_ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# Avoid races when creating pacemaker resources
crowbar_pacemaker_sync_mark "wait-cinder_ha_resources"

rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []

api_primitive = "cinder-api"
Expand Down Expand Up @@ -92,7 +93,7 @@
end

crowbar_pacemaker_order_only_existing "o-#{clone_name}" do
ordering ["postgresql", "rabbitmq", "cl-keystone", clone_name]
ordering ["postgresql", "#{rabbit_settings[:pacemaker_resource]}", "cl-keystone", clone_name]
score "Optional"
action :create
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Expand Down
12 changes: 12 additions & 0 deletions chef/cookbooks/cinder/templates/default/cinder.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,11 @@ rpc_response_timeout = <%= node[:cinder][:rpc_response_timeout] %>
# A URL representing the messaging driver to use and its full configuration. If
# not set, we fall back to the rpc_backend option and driver specific
# configuration. (string value)
<% if @rabbit_settings['use_legacy_configuration'] -%>
#transport_url = <None>
<% else -%>
transport_url = <%= @rabbit_settings[:url] %>
<% end -%>

# The messaging driver to use, defaults to rabbit. Other drivers include qpid
# and zmq. (string value)
Expand Down Expand Up @@ -3464,7 +3468,11 @@ lock_path = /var/run/cinder
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_durable_queues
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#amqp_durable_queues = false
<% else -%>
amqp_durable_queues = <%= @rabbit_settings[:durable_queues] %>
<% end -%>

# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
Expand Down Expand Up @@ -3562,7 +3570,11 @@ rabbit_virtual_host = <%= @rabbit_settings[:vhost] %>
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
# must wipe the RabbitMQ database. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_ha_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#rabbit_ha_queues = false
<% else -%>
rabbit_ha_queues = <%= @rabbit_settings[:ha_queues] %>
<% end -%>

# Number of seconds after which the Rabbit broker is considered down if
# heartbeat's keep-alive fails (0 disable the heartbeat). EXPERIMENTAL (integer
Expand Down
71 changes: 57 additions & 14 deletions chef/cookbooks/crowbar-openstack/libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,65 @@ def self.rabbitmq_settings(node, barclamp)
end

if @rabbitmq_settings && @rabbitmq_settings.include?(instance)
Chef::Log.info("RabbitMQ server found at #{@rabbitmq_settings[instance][:address]} [cached]")
Chef::Log.info("RabbitMQ settings found [cached]")
else
@rabbitmq_settings ||= Hash.new
rabbit = get_node(node, "rabbitmq-server", "rabbitmq", instance)
rabbits = get_nodes(node, "rabbitmq-server", "rabbitmq", instance)

if rabbit.nil?
if rabbits.empty?
Chef::Log.warn("No RabbitMQ server found!")
else
@rabbitmq_settings[instance] = {
address: rabbit[:rabbitmq][:address],
port: rabbit[:rabbitmq][:port],
user: rabbit[:rabbitmq][:user],
password: rabbit[:rabbitmq][:password],
vhost: rabbit[:rabbitmq][:vhost],
url: "rabbit://#{rabbit[:rabbitmq][:user]}:" \
one_rabbit = rabbits.first

if one_rabbit[:rabbitmq][:cluster]
rabbit_hosts = rabbits.map do |rabbit|
port = rabbit[:rabbitmq][:port]

"#{rabbit[:rabbitmq][:user]}:" \
"#{rabbit[:rabbitmq][:password]}@" \
"#{rabbit[:rabbitmq][:address]}:#{rabbit[:rabbitmq][:port]}/" \
"#{rabbit[:rabbitmq][:vhost]}"
}
"#{rabbit[:rabbitmq][:address]}:#{port}"
end

rabbit_node_names = rabbits.map do |rabbit_node|
"\'rabbit@#{rabbit_node.name}\'"
end

cluster_nodes = rabbit_node_names.join(",")

@rabbitmq_settings[instance] = {
clustered: true,
ha_queues: true,
durable_queues: true,
use_legacy_configuration: false,
url: "rabbit://#{rabbit_hosts.sort.join(",")}/" \
"#{one_rabbit[:rabbitmq][:vhost]}",
pacemaker_resource: "ms-rabbitmq",
cluster_nodes: cluster_nodes
}
Chef::Log.info("RabbitMQ cluster found")
else
rabbit = one_rabbit
port = rabbit[:rabbitmq][:port]

@rabbitmq_settings[instance] = {
clustered: false,
ha_queues: false,
durable_queues: false,
use_legacy_configuration: true,
address: rabbit[:rabbitmq][:address],
port: rabbit[:rabbitmq][:port],
user: rabbit[:rabbitmq][:user],
password: rabbit[:rabbitmq][:password],
vhost: rabbit[:rabbitmq][:vhost],
url: "rabbit://#{rabbit[:rabbitmq][:user]}:" \
"#{rabbit[:rabbitmq][:password]}@" \
"#{rabbit[:rabbitmq][:address]}:#{port}/" \
"#{rabbit[:rabbitmq][:vhost]}",
pacemaker_resource: "rabbitmq"
}

Chef::Log.info("RabbitMQ server found at #{@rabbitmq_settings[instance][:address]}")
Chef::Log.info("RabbitMQ server found")
end
end
end

Expand All @@ -153,4 +191,9 @@ def self.get_node(node, role, barclamp, instance)

result
end

def self.get_nodes(node, role, barclamp, instance)
nodes, _, _ = Chef::Search::Query.new.search(:node, "roles:#{role} AND #{barclamp}_config_environment:#{barclamp}-config-#{instance}")
nodes
end
end
3 changes: 2 additions & 1 deletion chef/cookbooks/glance/recipes/ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
crowbar_pacemaker_sync_mark "wait-glance_ha_resources"

primitives = []
rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []

["registry", "api"].each do |service|
Expand Down Expand Up @@ -94,7 +95,7 @@
end

crowbar_pacemaker_order_only_existing "o-#{clone_name}" do
ordering ["postgresql", "rabbitmq", "cl-keystone", clone_name]
ordering ["postgresql", "#{rabbit_settings[:pacemaker_resource]}", "cl-keystone", clone_name]
score "Optional"
action :create
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Expand Down
12 changes: 12 additions & 0 deletions chef/cookbooks/glance/templates/default/glance-api.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,11 @@ notification_driver = messaging
# A URL representing the messaging driver to use and its full
# configuration. If not set, we fall back to the rpc_backend option
# and driver specific configuration. (string value)
<% if @rabbit_settings['use_legacy_configuration'] -%>
#transport_url = <None>
<% else -%>
transport_url = <%= @rabbit_settings[:url] %>
<% end -%>

# The messaging driver to use, defaults to rabbit. Other drivers
# include qpid and zmq. (string value)
Expand Down Expand Up @@ -1389,7 +1393,11 @@ lock_path = /var/run/glance
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_durable_queues
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#amqp_durable_queues = false
<% else -%>
amqp_durable_queues = <%= @rabbit_settings[:durable_queues] %>
<% end -%>

# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
Expand Down Expand Up @@ -1493,7 +1501,11 @@ rabbit_virtual_host = <%= @rabbit_settings[:vhost] %>
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
# option, you must wipe the RabbitMQ database. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_ha_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#rabbit_ha_queues = false
<% else -%>
rabbit_ha_queues = <%= @rabbit_settings[:ha_queues] %>
<% end -%>

# Number of seconds after which the Rabbit broker is considered down
# if heartbeat's keep-alive fails (0 disable the heartbeat).
Expand Down
12 changes: 12 additions & 0 deletions chef/cookbooks/glance/templates/default/glance-registry.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ notification_driver = messaging
# A URL representing the messaging driver to use and its full
# configuration. If not set, we fall back to the rpc_backend option
# and driver specific configuration. (string value)
<% if @rabbit_settings['use_legacy_configuration'] -%>
#transport_url = <None>
<% else -%>
transport_url = <%= @rabbit_settings[:url] %>
<% end -%>

# The messaging driver to use, defaults to rabbit. Other drivers
# include qpid and zmq. (string value)
Expand Down Expand Up @@ -1123,7 +1127,11 @@ admin_tenant_name = <%= @keystone_settings['service_tenant'] %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_durable_queues
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#amqp_durable_queues = false
<% else -%>
amqp_durable_queues = <%= @rabbit_settings[:durable_queues] %>
<% end -%>

# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
Expand Down Expand Up @@ -1227,7 +1235,11 @@ rabbit_virtual_host = <%= @rabbit_settings[:vhost] %>
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
# option, you must wipe the RabbitMQ database. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_ha_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#rabbit_ha_queues = false
<% else -%>
rabbit_ha_queues = <%= @rabbit_settings[:ha_queues] %>
<% end -%>

# Number of seconds after which the Rabbit broker is considered down
# if heartbeat's keep-alive fails (0 disable the heartbeat).
Expand Down
3 changes: 2 additions & 1 deletion chef/cookbooks/heat/recipes/ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
crowbar_pacemaker_sync_mark "wait-heat_ha_resources"

primitives = []
rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []

["engine", "api", "api_cfn", "api_cloudwatch"].each do |service|
Expand Down Expand Up @@ -92,7 +93,7 @@
end

crowbar_pacemaker_order_only_existing "o-#{clone_name}" do
ordering ["postgresql", "rabbitmq", "cl-keystone", "cl-g-nova-controller", clone_name]
ordering ["postgresql", "#{rabbit_settings[:pacemaker_resource]}", "cl-keystone", "cl-g-nova-controller", clone_name]
score "Optional"
action :create
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Expand Down
12 changes: 12 additions & 0 deletions chef/cookbooks/heat/templates/default/heat.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@ use_stderr=false
# A URL representing the messaging driver to use and its full configuration. If
# not set, we fall back to the rpc_backend option and driver specific
# configuration. (string value)
<% if @rabbit_settings['use_legacy_configuration'] -%>
#transport_url = <None>
<% else -%>
transport_url = <%= @rabbit_settings[:url] %>
<% end -%>

# The messaging driver to use, defaults to rabbit. Other drivers include qpid
# and zmq. (string value)
Expand Down Expand Up @@ -1396,7 +1400,11 @@ admin_tenant_name=<%= @keystone_settings['service_tenant'] %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_durable_queues
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#amqp_durable_queues = false
<% else -%>
amqp_durable_queues = <%= @rabbit_settings[:durable_queues] %>
<% end -%>

# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
Expand Down Expand Up @@ -1492,7 +1500,11 @@ rabbit_virtual_host=<%= @rabbit_settings[:vhost] %>
# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this option, you
# must wipe the RabbitMQ database. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_ha_queues
<% if @rabbit_settings['use_legacy_configuration'] -%>
#rabbit_ha_queues = false
<% else -%>
rabbit_ha_queues = <%= @rabbit_settings[:ha_queues] %>
<% end -%>

# Number of seconds after which the Rabbit broker is considered down if
# heartbeat's keep-alive fails (0 disable the heartbeat). EXPERIMENTAL (integer
Expand Down
3 changes: 2 additions & 1 deletion chef/cookbooks/keystone/recipes/ha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# then we will avoid races there too as pacemaker will start the service).
crowbar_pacemaker_sync_mark "wait-keystone_ha_resources"

rabbit_settings = fetch_rabbitmq_settings
transaction_objects = []

service_name = "keystone"
Expand Down Expand Up @@ -85,7 +86,7 @@
end

crowbar_pacemaker_order_only_existing "o-#{clone_name}" do
ordering ["postgresql", "rabbitmq", clone_name]
ordering ["postgresql", "#{rabbit_settings[:pacemaker_resource]}", clone_name]
score "Optional"
action :create
only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }
Expand Down
Loading