From 3a576acbc47a3cac3a1007c48e4b6a78a00d40d2 Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Wed, 9 Apr 2014 23:39:41 +0800 Subject: [PATCH] Let "osapi_volume_listen" can be configurable When setup cinder in multiple nodes, cinder-api and cinder-volume will not exist in same node, so we should avoid value of "osapi_volume_listen" to be "0.0.0.0" and should set it as the ip of volume api host. Change-Id: I6daa46d497297e8e4ab9faa2caa953d242cc424e Closes-bug: #1305157 --- recipes/cinder-common.rb | 4 +++- spec/cinder_common_spec.rb | 5 +++++ templates/default/cinder.conf.erb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 905dda5..683bb03 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -50,6 +50,7 @@ if node['openstack']['block-storage']['volume']['driver'] == 'cinder.volume.driv end glance_api_endpoint = endpoint 'image-api' +cinder_api_endpoint = endpoint 'block-storage-api' directory '/etc/cinder' do group node['openstack']['block-storage']['group'] @@ -70,7 +71,8 @@ template '/etc/cinder/cinder.conf' do rabbit_hosts: rabbit_hosts, glance_host: glance_api_endpoint.host, glance_port: glance_api_endpoint.port, - solidfire_pass: solidfire_pass + solidfire_pass: solidfire_pass, + volume_api_address: cinder_api_endpoint.host ) end diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index 941ef57..e34259d 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -63,6 +63,11 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to render_file(file.name).with_content('volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver') end + it 'has osapi_volume_listen set' do + node.set['openstack']['endpoints']['block-storage-api']['host'] = '1.1.1.1' + expect(chef_run).to render_file(file.name).with_content('osapi_volume_listen=1.1.1.1') + end + it 'has rpc_thread_pool_size' do expect(chef_run).to render_file(file.name).with_content('rpc_thread_pool_size=64') end diff --git a/templates/default/cinder.conf.erb b/templates/default/cinder.conf.erb index 2445010..43c93c1 100644 --- a/templates/default/cinder.conf.erb +++ b/templates/default/cinder.conf.erb @@ -215,7 +215,7 @@ quota_driver=<%= node["openstack"]["block-storage"]["quota_driver"] %> #### periodic task scheduler to reduce stampeding. (Disable by #### setting to 0) -# osapi_volume_listen=0.0.0.0 +osapi_volume_listen=<%= @volume_api_address %> #### (StrOpt) IP address for OpenStack Volume API to listen # osapi_volume_listen_port=8776