Add ability to specify api host/port in config file

Add the ability to override the default listen IP/port for the api
service in the config file.
Use the ['telemetry-api-bind'] namespace to derive these values

Implements blueprint increase-ip-binding-flexibility

Change-Id: Ia51bd1b760563f06ed36ec8190f36f4e03a79695
This commit is contained in:
Darren Birkett 2014-04-25 11:40:08 +01:00
parent 1468086891
commit 0d04a07734
4 changed files with 28 additions and 4 deletions

View File

@ -63,6 +63,14 @@ Attributes
TODO: Add DB2 support on other platforms
* `openstack['telemetry']['platform']['db2_python_packages']` - Array of DB2 python packages, only available on redhat platform
The following attributes are defined in attributes/default.rb of the common cookbook, but are documented here due to their relevance:
* `openstack['endpoints']['telemetry-api-bind']['host']` - The IP address to bind the api service to
* `openstack['endpoints']['telemetry-api-bind']['port']` - The port to bind the api service to
* `openstack['endpoints']['telemetry-api-bind']['bind_interface']` - The interface name to bind the api service to
If the value of the 'bind_interface' attribute is non-nil, then the telemetry service will be bound to the first IP address on that interface. If the value of the 'bind_interface' attribute is nil, then the telemetry service will be bound to the IP address specifie
Testing
=====

View File

@ -62,6 +62,7 @@ service_tenant = node['openstack']['telemetry']['service_tenant_name']
identity_endpoint = endpoint 'identity-api'
identity_admin_endpoint = endpoint 'identity-admin'
image_endpoint = endpoint 'image-api'
telemetry_api_bind = endpoint 'telemetry-api-bind'
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['telemetry']['api']['auth']['version']
@ -96,7 +97,9 @@ template node['openstack']['telemetry']['conf'] do
service_pass: service_pass,
service_tenant_name: service_tenant,
service_user: service_user,
metering_secret: metering_secret
metering_secret: metering_secret,
api_bind_host: telemetry_api_bind.host,
api_bind_port: telemetry_api_bind.port
)
end

View File

@ -164,6 +164,18 @@ describe 'openstack-telemetry::common' do
r = /^hypervisor_inspector = libvirt$/
expect(chef_run).to render_file(file.name).with_content(r)
end
it 'has bind_host set' do
node.set['openstack']['endpoints']['telemetry-api-bind']['host'] = '1.1.1.1'
expect(chef_run).to render_file(file.name).with_content(
/^host = 1.1.1.1$/)
end
it 'has bind_port set' do
node.set['openstack']['endpoints']['telemetry-api-bind']['port'] = '9999'
expect(chef_run).to render_file(file.name).with_content(
/^port = 9999$/)
end
end
describe 'policy.json' do

View File

@ -1,7 +1,4 @@
[DEFAULT]
<% if node["openstack"]["telemetry"]["host"] %>
host = <%= node["openstack"]["telemetry"]["host"] %>
<% end %>
os_auth_url = <%= @auth_uri %>
os_tenant_name = <%= @service_tenant_name %>
os_password = <%= @service_pass %>
@ -57,6 +54,10 @@ periodic_interval = <%= node["openstack"]["telemetry"]["periodic_interval"] %>
[database]
connection=<%= @database_connection %>
[api]
host = <%= @api_bind_host %>
port = <%= @api_bind_port %>
[keystone_authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_uri = <%= @auth_uri %>