diff --git a/README.md b/README.md index 4e6b6d4..fb04216 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Attributes * `openstack["block-storage"]["db"]["username"]` - cinder username for database TODO: Add DB2 support on other platforms * `openstack["block-storage"]["platform"]["db2_python_packages"]` - Array of DB2 python packages, only available on redhat platform +* `openstack["block-storage"]["volume_name_template"]` - Template string to be used to generate volume names +* `openstack["block-storage"]["snapshot_name_template"]` - Template string to be used to generate snapshot names MQ attributes ------------- diff --git a/attributes/default.rb b/attributes/default.rb index 8e559e8..022e3a6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -43,6 +43,10 @@ default['openstack']['block-storage']['lock_path'] = '/var/lock/cinder' default['openstack']['block-storage']['region'] = 'RegionOne' default['openstack']['block-storage']['scheduler_role'] = 'os-block-storage-scheduler' +# Template strings to be used to generate resource names +default['openstack']['block-storage']['volume_name_template'] = 'volume-%s' +default['openstack']['block-storage']['snapshot_name_template'] = 'snapshot-%s' + # The name of the Chef role that knows about the message queue server # that Cinder uses default['openstack']['block-storage']['rabbit_server_chef_role'] = 'os-ops-messaging' diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index ae0014f..65816da 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -49,6 +49,11 @@ describe "openstack-block-storage::cinder-common" do expect(sprintf("%o", @file.mode)).to eq "644" end + it "has name templates" do + expect(@chef_run).to render_file(@file.name).with_content("volume_name_template=volume-%s") + expect(@chef_run).to render_file(@file.name).with_content("snapshot_name_template=snapshot-%s") + end + it "has rpc_backend set" do expect(@chef_run).to render_file(@file.name).with_content("rpc_backend=cinder.openstack.common.rpc.impl_kombu") end diff --git a/templates/default/cinder.conf.erb b/templates/default/cinder.conf.erb index 0a5b195..8e6a9b9 100644 --- a/templates/default/cinder.conf.erb +++ b/templates/default/cinder.conf.erb @@ -265,10 +265,10 @@ db_backend=sqlalchemy # enable_new_services=true #### (BoolOpt) Services to be added to the available pool on create -# volume_name_template=volume-%s +volume_name_template=<%= node["openstack"]["block-storage"]["volume_name_template"] %> #### (StrOpt) Template string to be used to generate volume names -# snapshot_name_template=snapshot-%s +snapshot_name_template=<%= node["openstack"]["block-storage"]["snapshot_name_template"] %> #### (StrOpt) Template string to be used to generate snapshot names