diff --git a/README.md b/README.md index 16c1c1a..8ff2566 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,8 @@ Cinder attributes * `openstack["block-storage"]["service_tenant_name"]` - name of tenant to use for the cinder service account in keystone * `openstack["block-storage"]["service_user"]` - cinder service user in keystone * `openstack["block-storage"]["service_role"]` - role for the cinder service user in keystone +* `openstack["block-storage"]["service_name"]` - Cinder Volume Service name in keystone, cinder for V1 and cinderv2 for v2. +* `openstack["block-storage"]["service_type"]` - Cinder Volume Service type in keystone, volume for V1 and volumev2 for v2. * `openstack["block-storage"]["notification_driver"]` - Set the notification driver to be used (default to cinder.openstack.common.notifier.rpc_notifier) * `openstack["block-storage"]["syslog"]["use"]` * `openstack["block-storage"]["syslog"]["facility"]` diff --git a/attributes/default.rb b/attributes/default.rb index 4aaf3aa..66e4a7e 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -130,6 +130,8 @@ end default['openstack']['block-storage']['service_tenant_name'] = 'service' default['openstack']['block-storage']['service_user'] = 'cinder' default['openstack']['block-storage']['service_role'] = 'service' +default['openstack']['block-storage']['service_name'] = 'cinderv2' +default['openstack']['block-storage']['service_type'] = 'volumev2' # SAN Support default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1' diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index cda7905..6aab05e 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -37,6 +37,8 @@ region = node['openstack']['block-storage']['region'] service_tenant_name = node['openstack']['block-storage']['service_tenant_name'] service_user = node['openstack']['block-storage']['service_user'] service_role = node['openstack']['block-storage']['service_role'] +service_name = node['openstack']['block-storage']['service_name'] +service_type = node['openstack']['block-storage']['service_type'] openstack_identity_register 'Register Service Tenant' do auth_uri auth_uri @@ -50,8 +52,8 @@ end openstack_identity_register 'Register Cinder V2 Volume Service' do auth_uri auth_uri bootstrap_token bootstrap_token - service_name 'cinderv2' - service_type 'volumev2' + service_name service_name + service_type service_type service_description 'Cinder Volume Service V2' endpoint_region region endpoint_adminurl ::URI.decode admin_cinder_api_endpoint.to_s @@ -63,8 +65,8 @@ end openstack_identity_register 'Register Cinder V2 Volume Endpoint' do auth_uri auth_uri bootstrap_token bootstrap_token - service_name 'cinderv2' - service_type 'volumev2' + service_name service_name + service_type service_type service_description 'Cinder Volume Service V2' endpoint_region region endpoint_adminurl ::URI.decode admin_cinder_api_endpoint.to_s diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index c726343..7f0547f 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -152,6 +152,25 @@ describe 'openstack-block-storage::identity_registration' do ) end + it 'with different service type/name' do + node.set['openstack']['block-storage']['service_name'] = 'cinder' + node.set['openstack']['block-storage']['service_type'] = 'volume' + + expect(chef_run).to create_endpoint_openstack_identity_register( + 'Register Cinder V2 Volume Endpoint' + ).with( + auth_uri: 'http://127.0.0.1:35357/v2.0', + bootstrap_token: 'bootstrap-token', + service_name: 'cinder', + service_type: 'volume', + service_description: 'Cinder Volume Service V2', + endpoint_region: 'RegionOne', + endpoint_adminurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s', + endpoint_internalurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s', + endpoint_publicurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s' + ) + end + it 'with custom region override' do node.set['openstack']['block-storage']['region'] = 'volumeRegion' expect(chef_run).to create_endpoint_openstack_identity_register(