Add ability to specify IP for service

The problem that this change addresses is that the address_for method
will not work correctly if there are multiple IP address associated
with the specified interface.

The approach to solving this problem and moving towards the overall
goal of having one place where service networking information is
stored is to convert address_for calls into endpoints, and add a
address() method to the endpoints interface for IP address resolution.

The address() method has the following behavior: if the
bind_interface of an endpoint is set, then the IP is looked up on
the interface.  Otherwise, the IP specified in the host attribute is
returned.  This allows the caller to choose either method of
determining what IP a service will be bound to.

This initial change switches both the openstack-ops-database and
openstack-ops-messaging cookbooks over to use endpoints instead of
address_for.  The other cookbooks will be switched over time.

blueprint increase-ip-binding-flexibility

Change-Id: I527e4e734f3c1eea9ac2567e0a90524d78ee867e
This commit is contained in:
Chris Dearborn
2014-02-18 14:35:20 -05:00
parent 5989edff5f
commit f6da45d11f
8 changed files with 101 additions and 40 deletions

View File

@@ -24,6 +24,13 @@
# expected to create the user, pass, vhost in a wrapper rabbitmq cookbook.
#
# ******************** RabbitMQ Endpoint **************************************
default['openstack']['endpoints']['mq']['host'] = '127.0.0.1'
default['openstack']['endpoints']['mq']['scheme'] = nil
default['openstack']['endpoints']['mq']['port'] = '5672'
default['openstack']['endpoints']['mq']['path'] = nil
default['openstack']['endpoints']['mq']['bind_interface'] = nil
###################################################################
# Services to assign mq attributes for
###################################################################
@@ -34,8 +41,11 @@ services = %w{block-storage compute image metering network orchestration}
###################################################################
default['openstack']['mq']['server_role'] = 'os-ops-messaging'
default['openstack']['mq']['service_type'] = 'rabbitmq'
default['openstack']['mq']['host'] = '127.0.0.1'
default['openstack']['mq']['port'] = '5672'
# Note that the openstack:mq:host and openstack:mq:port attributes are being
# deprecated in favor of the mq endpoint and will be removed in a future
# patch set.
default['openstack']['mq']['host'] = default['openstack']['endpoints']['mq']['host']
default['openstack']['mq']['port'] = default['openstack']['endpoints']['mq']['port']
default['openstack']['mq']['user'] = 'guest'
default['openstack']['mq']['vhost'] = '/'
@@ -55,16 +65,16 @@ qpid_defaults = {
heartbeat: 60,
protocol: 'tcp',
tcp_nodelay: true,
host: node['openstack']['mq']['host'],
port: node['openstack']['mq']['port'],
qpid_hosts: ["#{node['openstack']['mq']['host']}:#{node['openstack']['mq']['port']}"]
host: node['openstack']['endpoints']['mq']['host'],
port: node['openstack']['endpoints']['mq']['port'],
qpid_hosts: ["#{node['openstack']['endpoints']['mq']['host']}:#{node['openstack']['endpoints']['mq']['port']}"]
}
rabbit_defaults = {
userid: node['openstack']['mq']['user'],
vhost: node['openstack']['mq']['vhost'],
port: node['openstack']['mq']['port'],
host: node['openstack']['mq']['host'],
port: node['openstack']['endpoints']['mq']['port'],
host: node['openstack']['endpoints']['mq']['host'],
ha: false,
use_ssl: false
}