Browse Source

Make service name and type configurable

Change-Id: I3176bd266a89506db52ed9469c3aa68ce6839da2
Closes-Bug: #1452555
Masaki Matsushita 4 years ago
parent
commit
12d1c1ab83
4 changed files with 29 additions and 4 deletions
  1. 2
    0
      README.md
  2. 2
    0
      attributes/default.rb
  3. 6
    4
      recipes/identity_registration.rb
  4. 19
    0
      spec/identity_registration_spec.rb

+ 2
- 0
README.md View File

@@ -94,6 +94,8 @@ Cinder attributes
94 94
 * `openstack["block-storage"]["service_tenant_name"]` - name of tenant to use for the cinder service account in keystone
95 95
 * `openstack["block-storage"]["service_user"]` - cinder service user in keystone
96 96
 * `openstack["block-storage"]["service_role"]` - role for the cinder service user in keystone
97
+* `openstack["block-storage"]["service_name"]` - Cinder Volume Service name in keystone, cinder for V1 and cinderv2 for v2.
98
+* `openstack["block-storage"]["service_type"]` - Cinder Volume Service type in keystone, volume for V1 and volumev2 for v2.
97 99
 * `openstack["block-storage"]["notification_driver"]` - Set the notification driver to be used (default to cinder.openstack.common.notifier.rpc_notifier)
98 100
 * `openstack["block-storage"]["syslog"]["use"]`
99 101
 * `openstack["block-storage"]["syslog"]["facility"]`

+ 2
- 0
attributes/default.rb View File

@@ -130,6 +130,8 @@ end
130 130
 default['openstack']['block-storage']['service_tenant_name'] = 'service'
131 131
 default['openstack']['block-storage']['service_user'] = 'cinder'
132 132
 default['openstack']['block-storage']['service_role'] = 'service'
133
+default['openstack']['block-storage']['service_name'] = 'cinderv2'
134
+default['openstack']['block-storage']['service_type'] = 'volumev2'
133 135
 
134 136
 # SAN Support
135 137
 default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1'

+ 6
- 4
recipes/identity_registration.rb View File

@@ -37,6 +37,8 @@ region = node['openstack']['block-storage']['region']
37 37
 service_tenant_name = node['openstack']['block-storage']['service_tenant_name']
38 38
 service_user = node['openstack']['block-storage']['service_user']
39 39
 service_role = node['openstack']['block-storage']['service_role']
40
+service_name = node['openstack']['block-storage']['service_name']
41
+service_type = node['openstack']['block-storage']['service_type']
40 42
 
41 43
 openstack_identity_register 'Register Service Tenant' do
42 44
   auth_uri auth_uri
@@ -50,8 +52,8 @@ end
50 52
 openstack_identity_register 'Register Cinder V2 Volume Service' do
51 53
   auth_uri auth_uri
52 54
   bootstrap_token bootstrap_token
53
-  service_name 'cinderv2'
54
-  service_type 'volumev2'
55
+  service_name service_name
56
+  service_type service_type
55 57
   service_description 'Cinder Volume Service V2'
56 58
   endpoint_region region
57 59
   endpoint_adminurl ::URI.decode admin_cinder_api_endpoint.to_s
@@ -63,8 +65,8 @@ end
63 65
 openstack_identity_register 'Register Cinder V2 Volume Endpoint' do
64 66
   auth_uri auth_uri
65 67
   bootstrap_token bootstrap_token
66
-  service_name 'cinderv2'
67
-  service_type 'volumev2'
68
+  service_name service_name
69
+  service_type service_type
68 70
   service_description 'Cinder Volume Service V2'
69 71
   endpoint_region region
70 72
   endpoint_adminurl ::URI.decode admin_cinder_api_endpoint.to_s

+ 19
- 0
spec/identity_registration_spec.rb View File

@@ -152,6 +152,25 @@ describe 'openstack-block-storage::identity_registration' do
152 152
         )
153 153
       end
154 154
 
155
+      it 'with different service type/name' do
156
+        node.set['openstack']['block-storage']['service_name'] = 'cinder'
157
+        node.set['openstack']['block-storage']['service_type'] = 'volume'
158
+
159
+        expect(chef_run).to create_endpoint_openstack_identity_register(
160
+          'Register Cinder V2 Volume Endpoint'
161
+        ).with(
162
+          auth_uri: 'http://127.0.0.1:35357/v2.0',
163
+          bootstrap_token: 'bootstrap-token',
164
+          service_name: 'cinder',
165
+          service_type: 'volume',
166
+          service_description: 'Cinder Volume Service V2',
167
+          endpoint_region: 'RegionOne',
168
+          endpoint_adminurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s',
169
+          endpoint_internalurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s',
170
+          endpoint_publicurl: 'http://127.0.0.1:8776/v2/%(tenant_id)s'
171
+        )
172
+      end
173
+
155 174
       it 'with custom region override' do
156 175
         node.set['openstack']['block-storage']['region'] = 'volumeRegion'
157 176
         expect(chef_run).to create_endpoint_openstack_identity_register(

Loading…
Cancel
Save