Browse Source

refactoring final step

* added endpoint attributes (moved from common)
* removed qpid as a messaging option (can be incuded in a wrapper)
* deleted default attributes from nova.conf.rb originated in
  openstack-common
* adapted optimized endpoint logic
* removed rubocop exceptions in recipes and regenerated the
  .rubocop_todo.yaml containing all remaining exceptions
* added versionbumb for refactored os-identity and common
* moved version up to 13.0.0 for mitaka release
* removed fedora, suse as supported platform
* adapted the specs (unit tests) to work again
* added new logic into templates/default/cinder.conf.erb
* refactored attributes throughout all recipes that were connected to
  the attributes used for the cinder.conf.erb template to adapt the new
  template attribute syntax
* moved all attributes from attributes/default.rb that were used in
  cinder_conf.erb to attributes/cinder_conf.rb
* refactored attributes to fit upcomming template logic
* refactored recipes to fit upcomming template logic
* removed all attributes from default.rb and cinder.conf.erb which are set
  as default in attributes, openstack doc and used to render the template

Depends-On: Ifa5a7f4e1df47a3961976e64f654224864c3dcb4
Depends-On: I3262b2e6f792f37c32a446e6567790b82bdd4613
Depends-On: I0547182085eed91d05384fdd7734408a839a9a2c
Implements: blueprint cookbook-refactoring
Change-Id: Idadc97bd7380d6c4f9f6f33d9c6b1215a5f24772
Christoph Albers 3 years ago
parent
commit
4a7dc692b9

+ 31
- 21
.rubocop_todo.yml View File

@@ -1,21 +1,31 @@
1
-# This configuration was generated by `rubocop --auto-gen-config`
2
-# on 2015-05-28 14:36:48 -0500 using RuboCop version 0.29.1.
3
-# The point is for the user to remove these configuration records
4
-# one by one as the offenses are removed from the code base.
5
-# Note that changes in the inspected code, or installation of new
6
-# versions of RuboCop, may require this file to be generated again.
7
-
8
-# Offense count: 1
9
-Metrics/AbcSize:
10
-  Max: 18
11
-
12
-# Offense count: 5
13
-# Configuration parameters: EnforcedStyle, SupportedStyles.
14
-Style/ClassAndModuleChildren:
15
-  Enabled: false
16
-
17
-# Offense count: 1
18
-# Cop supports --auto-correct.
19
-# Configuration parameters: IgnoredMethods.
20
-Style/SymbolProc:
21
-  Enabled: false
1
+# This configuration was generated by
2
+# `rubocop --auto-gen-config`
3
+# on 2016-02-04 16:35:09 +0100 using RuboCop version 0.35.1.
4
+# The point is for the user to remove these configuration records
5
+# one by one as the offenses are removed from the code base.
6
+# Note that changes in the inspected code, or installation of new
7
+# versions of RuboCop, may require this file to be generated again.
8
+
9
+# Offense count: 10
10
+Lint/ParenthesesAsGroupedExpression:
11
+  Exclude:
12
+    - 'recipes/identity_registration.rb'
13
+
14
+# Offense count: 1
15
+Metrics/AbcSize:
16
+  Max: 18
17
+
18
+# Offense count: 1
19
+# Configuration parameters: CountComments.
20
+Metrics/MethodLength:
21
+  Max: 13
22
+
23
+# Offense count: 5
24
+# Configuration parameters: EnforcedStyle, SupportedStyles.
25
+Style/ClassAndModuleChildren:
26
+  Exclude:
27
+    - 'recipes/api.rb'
28
+    - 'recipes/cinder-common.rb'
29
+    - 'recipes/client.rb'
30
+    - 'recipes/identity_registration.rb'
31
+    - 'recipes/volume.rb'

+ 19
- 0
attributes/cinder_conf.rb View File

@@ -0,0 +1,19 @@
1
+default['openstack']['block-storage']['conf_secrets'] = {}
2
+default['openstack']['block-storage']['conf'].tap do |conf|
3
+  conf['DEFAULT']['notification_driver'] = 'cinder.openstack.common.notifier.rpc_notifier'
4
+  if node['openstack']['block-storage']['syslog']['use']
5
+    conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
6
+  end
7
+  conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type']
8
+  conf['DEFAULT']['my_ip'] = '127.0.0.1'
9
+  conf['DEFAULT']['auth_strategy'] = 'keystone'
10
+  conf['DEFAULT']['control_exchange'] = 'cinder'
11
+  conf['DEFAULT']['volume_group'] = 'cinder-volumes'
12
+  conf['DEFAULT']['state_path'] = '/var/lib/cinder'
13
+  conf['keystone_authtoken']['auth_plugin'] = 'v2password'
14
+  conf['keystone_authtoken']['region_name'] = node['openstack']['region']
15
+  conf['keystone_authtoken']['username'] = 'cinder'
16
+  conf['keystone_authtoken']['tenant_name'] = 'service'
17
+  conf['keystone_authtoken']['signing_dir'] = '/var/cache/cinder/api'
18
+  conf['oslo_concurrency']['lock_path'] = '/var/lib/cinder/tmp'
19
+end

+ 27
- 333
attributes/default.rb View File

@@ -24,7 +24,7 @@
24 24
 
25 25
 ########################################################################
26 26
 # Toggles - These can be overridden at the environment level
27
-default['developer_mode'] = false  # we want secure passwords by default
27
+default['developer_mode'] = false # we want secure passwords by default
28 28
 ########################################################################
29 29
 
30 30
 # Set to some text value if you want templated config files
@@ -34,32 +34,13 @@ default['openstack']['block-storage']['custom_template_banner'] = '
34 34
 # Do not edit, changes will be overwritten
35 35
 '
36 36
 
37
-default['openstack']['block-storage']['verbose'] = 'False'
38
-default['openstack']['block-storage']['debug'] = 'False'
39
-
40
-# Name of this node.  This can be an opaque identifier.  It is
41
-# not necessarily a hostname, FQDN, or IP address. (StrOpt)
42
-default['openstack']['block-storage']['host'] = nil
43
-
44 37
 # Specify policy.json remote file to import
45 38
 default['openstack']['block-storage']['policyfile_url'] = nil
46 39
 
47
-# Default notification_driver and control exchange
48
-default['openstack']['block-storage']['notification_driver'] = 'cinder.openstack.common.notifier.rpc_notifier'
49
-default['openstack']['block-storage']['control_exchange'] = 'cinder'
50 40
 # Availability zone/region for the OpenStack Block-Storage service
51 41
 default['openstack']['block-storage']['region'] = node['openstack']['region']
52 42
 default['openstack']['block-storage']['scheduler_role'] = 'os-block-storage-scheduler'
53 43
 
54
-# Number of workers for OpenStack Volume API service. The
55
-# default is equal to the number of CPUs available. (integer
56
-# value)
57
-default['openstack']['block-storage']['osapi_volume_workers'] = [8, node['cpu']['total'].to_i].min
58
-
59
-# Template strings to be used to generate resource names
60
-default['openstack']['block-storage']['volume_name_template'] = 'volume-%s'
61
-default['openstack']['block-storage']['snapshot_name_template'] = 'snapshot-%s'
62
-
63 44
 # The name of the Chef role that knows about the message queue server
64 45
 # that Cinder uses
65 46
 default['openstack']['block-storage']['rabbit_server_chef_role'] = 'os-ops-messaging'
@@ -67,212 +48,18 @@ default['openstack']['block-storage']['rabbit_server_chef_role'] = 'os-ops-messa
67 48
 # This is the name of the Chef role that will install the Keystone Service API
68 49
 default['openstack']['block-storage']['keystone_service_chef_role'] = 'keystone'
69 50
 
70
-# Whether to enable cinder-backup service or not
71
-default['openstack']['block-storage']['backup']['enabled'] = false
72
-
73
-# Keystone PKI signing directory
74
-default['openstack']['block-storage']['api']['auth']['cache_dir'] = '/var/cache/cinder/api'
75
-
76
-default['openstack']['block-storage']['api']['auth']['version'] = node['openstack']['api']['auth']['version']
77
-
78
-# A list of memcached server(s) to use for caching
79
-default['openstack']['block-storage']['api']['auth']['memcached_servers'] = nil
80
-
81
-# Whether token data should be authenticated or authenticated and encrypted. Acceptable values are MAC or ENCRYPT
82
-default['openstack']['block-storage']['api']['auth']['memcache_security_strategy'] = nil
83
-
84
-# This string is used for key derivation
85
-default['openstack']['block-storage']['api']['auth']['memcache_secret_key'] = nil
86
-
87
-# Hash algorithms to use for hashing PKI tokens
88
-default['openstack']['block-storage']['api']['auth']['hash_algorithms'] = 'md5'
89
-
90
-# A PEM encoded Certificate Authority to use when verifying HTTPs connections
91
-default['openstack']['block-storage']['api']['auth']['cafile'] = nil
92
-
93
-# Verify HTTPS connections
94
-default['openstack']['block-storage']['api']['auth']['insecure'] = false
95
-
96
-# If True, this indicates that glance-api allows the client to perform
97
-# insecure SSL(https) requests; this should be the same as the setting
98
-# in the glance-api service.
99
-default['openstack']['block-storage']['image']['glance_api_insecure'] = false
100
-
101
-# Location of ca certificates file to use for glance client requests
102
-default['openstack']['block-storage']['image']['glance_ca_certificates_file'] = nil
103
-
104
-# Which version of the glance API cinder should use when talking to glance.
105
-default['openstack']['block-storage']['image']['glance_api_version'] = 1
106
-
107
-# Maximum allocatable gigabytes
108
-# Should equal total backend storage, default is 10TB
109
-default['openstack']['block-storage']['max_gigabytes'] = '10000'
110
-
111
-# Storage availability zone
112
-# Default is nova
113
-default['openstack']['block-storage']['storage_availability_zone'] = 'nova'
114
-
115
-# Quota definitions
116
-default['openstack']['block-storage']['quota_volumes'] = '10'
117
-default['openstack']['block-storage']['quota_gigabytes'] = '1000'
118
-default['openstack']['block-storage']['quota_driver'] = 'cinder.quota.DbQuotaDriver'
119
-default['openstack']['block-storage']['quota_snapshots'] = 10
120
-default['openstack']['block-storage']['no_snapshot_gb_quota'] = false
121
-default['openstack']['block-storage']['use_default_quota_class'] = true
122
-
123
-# Common rpc definitions
124
-default['openstack']['block-storage']['rpc_thread_pool_size'] = 64
125
-default['openstack']['block-storage']['rpc_conn_pool_size'] = 30
126
-default['openstack']['block-storage']['rpc_response_timeout'] = 60
127
-case node['openstack']['mq']['service_type']
128
-when 'rabbitmq'
129
-  default['openstack']['block_storage']['rpc_backend'] = 'cinder.openstack.common.rpc.impl_kombu'
130
-when 'qpid'
131
-  default['openstack']['block_storage']['rpc_backend'] = 'cinder.openstack.common.rpc.impl_qpid'
132
-end
133
-
134
-default['openstack']['block-storage']['service_tenant_name'] = 'service'
135 51
 default['openstack']['block-storage']['service_user'] = 'cinder'
52
+default['openstack']['block-storage']['service_tenant_name'] = 'service'
136 53
 default['openstack']['block-storage']['service_role'] = 'service'
137 54
 default['openstack']['block-storage']['service_name'] = 'cinderv2'
138 55
 default['openstack']['block-storage']['service_type'] = 'volumev2'
139 56
 
140
-# SAN Support
141
-default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1'
142
-default['openstack']['block-storage']['san']['san_login'] = 'admin'
143
-default['openstack']['block-storage']['san']['san_private_key'] = '/v7000_rsa'
144
-# The location(URL) of the san_private_key. This value may also specify HTTP(http://), FTP("ftp://"), or local(file://), if the san private key is in the local, you should also specify this attribute using(file://)
145
-default['openstack']['block-storage']['san']['san_private_key_url'] = nil
146
-
147
-# NFS support
148
-default['openstack']['block-storage']['nfs']['nas_ip'] = '127.0.0.1'
149
-default['openstack']['block-storage']['nfs']['nas_login'] = 'admin'
150
-default['openstack']['block-storage']['nfs']['nas_ssh_port'] = '22'
151
-
152
-# Netapp support
153
-default['openstack']['block-storage']['netapp']['protocol'] = 'http'
154
-default['openstack']['block-storage']['netapp']['dfm_hostname'] = nil
155
-default['openstack']['block-storage']['netapp']['dfm_login'] = nil
156
-default['openstack']['block-storage']['netapp']['dfm_password'] = nil
157
-default['openstack']['block-storage']['netapp']['dfm_port'] = '8088'
158
-default['openstack']['block-storage']['netapp']['dfm_web_port'] = '8080'
159
-default['openstack']['block-storage']['netapp']['storage_service'] = 'storage_service'
160
-
161
-# Netapp direct NFS
162
-default['openstack']['block-storage']['netapp']['netapp_server_port'] = '80'
163
-default['openstack']['block-storage']['netapp']['netapp_server_hostname'] = nil
164
-default['openstack']['block-storage']['netapp']['netapp_server_password'] = nil
165
-default['openstack']['block-storage']['netapp']['netapp_server_login'] = nil
166
-default['openstack']['block-storage']['netapp']['export'] = nil
167
-default['openstack']['block-storage']['nfs']['shares_config'] = '/etc/cinder/shares.conf'
168
-default['openstack']['block-storage']['nfs']['mount_point_base'] = '/mnt/cinder-volumes'
169
-default['openstack']['block-storage']['nfs']['nfs_disk_util'] = 'df'
170
-default['openstack']['block-storage']['nfs']['nfs_sparsed_volumes'] = 'true'
171
-
172
-# Storwize/SVC Support
173
-default['openstack']['block-storage']['storwize']['san_ip'] = node['openstack']['block-storage']['san']['san_ip']
174
-default['openstack']['block-storage']['storwize']['san_login'] = node['openstack']['block-storage']['san']['san_login']
175
-# If the key is set to nil, the san_login and san_password will be used.
176
-default['openstack']['block-storage']['storwize']['san_private_key'] = node['openstack']['block-storage']['san']['san_private_key']
177
-default['openstack']['block-storage']['storwize']['san_private_key_url'] = node['openstack']['block-storage']['san']['san_private_key_url']
178
-default['openstack']['block-storage']['storwize']['storwize_svc_volpool_name'] = 'volpool'
179
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_rsize'] = 2
180
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_warning'] = 0
181
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_autoexpand'] = true
182
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_grainsize'] = 256
183
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_compression'] = false
184
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_easytier'] = true
185
-default['openstack']['block-storage']['storwize']['storwize_svc_flashcopy_timeout'] = 120
186
-default['openstack']['block-storage']['storwize']['storwize_svc_vol_iogrp'] = 0
187
-default['openstack']['block-storage']['storwize']['storwize_svc_connection_protocol'] = 'iSCSI'
188
-default['openstack']['block-storage']['storwize']['storwize_svc_iscsi_chap_enabled'] = true
189
-default['openstack']['block-storage']['storwize']['storwize_svc_multipath_enabled'] = false
190
-default['openstack']['block-storage']['storwize']['storwize_svc_multihostmap_enabled'] = true
191
-default['openstack']['block-storage']['storwize']['storwize_svc_allow_tenant_qos'] = false
192
-default['openstack']['block-storage']['storwize']['storwize_svc_stretched_cluster_partner'] = nil
193
-
194
-# SolidFire Support
195
-default['openstack']['block-storage']['solidfire']['san_ip'] = node['openstack']['block-storage']['san']['san_ip']
196
-default['openstack']['block-storage']['solidfire']['san_login'] = node['openstack']['block-storage']['san']['san_login']
197
-default['openstack']['block-storage']['solidfire']['sf_emulate'] = 'False'
198
-default['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = nil
199
-
200
-# FlashSystem Support
201
-default['openstack']['block-storage']['flashsystem']['san_ip'] = node['openstack']['block-storage']['san']['san_ip']
202
-default['openstack']['block-storage']['flashsystem']['san_login'] = node['openstack']['block-storage']['san']['san_login']
203
-# The connection protocol for FlashSystem data path (FC only, will introduce iSCSI in Liberty)
204
-default['openstack']['block-storage']['flashsystem']['flashsystem_connection_protocol'] = 'FC'
205
-# The multipath enablement flag (FC only, iSCSI multipath will be controlled by Nova)
206
-default['openstack']['block-storage']['flashsystem']['flashsystem_multipath_enabled'] = false
207
-# Enable vdisk to multi-host mapping
208
-default['openstack']['block-storage']['flashsystem']['flashsystem_multihostmap_enabled'] = true
209
-
210
-# EMC VMAX/VNX tSupport
211
-# The EmcUserName user's password is stored in an encrypted databag and
212
-# accessed with openstack-common cookbook library's "get_password" routeine. You
213
-# are expected to create the user and pass in a wrapper cookbook.
214
-default['openstack']['block-storage']['emc']['iscsi_target_prefix'] = 'iqn.1992-04.com.emc'
215
-default['openstack']['block-storage']['emc']['cinder_emc_config_file'] = '/etc/cinder/cinder_emc_config.xml'
216
-default['openstack']['block-storage']['emc']['StorageType'] = 0
217
-default['openstack']['block-storage']['emc']['EcomServerIP'] = '127.0.0.1'
218
-default['openstack']['block-storage']['emc']['EcomServerPort'] = '5988'
219
-default['openstack']['block-storage']['emc']['EcomUserName'] = 'admin'
220
-default['openstack']['block-storage']['emc']['MaskingView'] = nil
221
-
222
-# VMware Support
223
-default['openstack']['block-storage']['vmware']['secret_name'] = 'openstack_vmware_secret_name'
224
-default['openstack']['block-storage']['vmware']['vmware_host_ip'] = ''
225
-default['openstack']['block-storage']['vmware']['vmware_host_username'] = ''
226
-default['openstack']['block-storage']['vmware']['vmware_wsdl_location'] = nil
227
-default['openstack']['block-storage']['vmware']['vmware_api_retry_count'] = 10
228
-default['openstack']['block-storage']['vmware']['vmware_task_poll_interval'] = 5
229
-default['openstack']['block-storage']['vmware']['vmware_volume_folder'] = 'cinder-volumes'
230
-default['openstack']['block-storage']['vmware']['vmware_image_transfer_timeout_secs'] = 7200
231
-default['openstack']['block-storage']['vmware']['vmware_max_objects_retrieval'] = 100
232
-
233
-# IBM GPFS Support
234
-default['openstack']['block-storage']['gpfs']['gpfs_mount_point_base'] = node['openstack']['block-storage']['gpfs']['gpfs_mount_point_base']
235
-default['openstack']['block-storage']['gpfs']['gpfs_images_dir'] = node['openstack']['block-storage']['gpfs']['gpfs_images_dir']
236
-default['openstack']['block-storage']['gpfs']['gpfs_images_share_mode'] = 'copy_on_write'
237
-default['openstack']['block-storage']['gpfs']['gpfs_sparse_volumes'] = true
238
-default['openstack']['block-storage']['gpfs']['gpfs_max_clone_depth'] = 8
239
-default['openstack']['block-storage']['gpfs']['gpfs_storage_pool'] = 'system'
240
-
241
-# IBMNAS (SONAS, Storwize V7000 Unified) Support
242
-# The attribute "nas_password" is stored in databag and
243
-# accessed with openstack-common cookbook library's "get_password" routeine.
244
-default['openstack']['block-storage']['ibmnas']['nas_ip'] = node['openstack']['block-storage']['nfs']['nas_ip']
245
-default['openstack']['block-storage']['ibmnas']['nas_login'] = node['openstack']['block-storage']['nfs']['nas_login']
246
-default['openstack']['block-storage']['ibmnas']['nas_ssh_port'] = node['openstack']['block-storage']['nfs']['nas_ssh_port']
247
-default['openstack']['block-storage']['ibmnas']['shares_config'] = '/etc/cinder/nfs_shares.conf'
248
-default['openstack']['block-storage']['ibmnas']['mount_point_base'] = '/mnt/cinder-volumes'
249
-default['openstack']['block-storage']['ibmnas']['nfs_sparsed_volumes'] = 'true'
250
-default['openstack']['block-storage']['ibmnas']['nas_access_ip'] = nil
251
-default['openstack']['block-storage']['ibmnas']['export'] = nil
252
-# Platform type to be used as backend storage, valid values are:
253
-# 'v7ku : for using IBM Storwize V7000 Unified
254
-# 'sonas : for using IBM Scale Out NAS
255
-# 'gpfs-nas : for using NFS based IBM GPFS deployments
256
-default['openstack']['block-storage']['ibmnas']['ibmnas_platform_type'] = 'v7ku'
257
-
258 57
 # logging attribute
259 58
 default['openstack']['block-storage']['syslog']['use'] = false
260 59
 default['openstack']['block-storage']['syslog']['facility'] = 'LOG_LOCAL2'
261 60
 default['openstack']['block-storage']['syslog']['config_facility'] = 'local2'
262 61
 
263
-default['openstack']['block-storage']['api']['ratelimit'] = 'True'
264
-default['openstack']['block-storage']['cron']['minute'] = '00'
265
-default['openstack']['block-storage']['cron']['audit_logfile'] = '/var/log/cinder/audit.log'
266
-
267
-default['openstack']['block-storage']['volume']['state_path'] = '/var/lib/cinder'
268
-default['openstack']['block-storage']['volume']['volumes_dir'] = '/var/lib/cinder/volumes'
269
-default['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMVolumeDriver'
270
-default['openstack']['block-storage']['volume']['volume_group'] = 'cinder-volumes'
271 62
 default['openstack']['block-storage']['volume']['volume_group_size'] = 40
272
-default['openstack']['block-storage']['volume']['volume_clear_size'] = 0
273
-default['openstack']['block-storage']['volume']['volume_clear'] = 'zero'
274
-
275
-default['openstack']['block-storage']['volume']['create_volume_group'] = false
276 63
 # Type of volume group to create:
277 64
 # - 'file' for basic 40g file for testing
278 65
 # - 'block_devices' for using block devices, specified in block_devices attribute
@@ -281,72 +68,13 @@ default['openstack']['block-storage']['volume']['create_volume_group_type'] = 'f
281 68
 # Examples: '/dev/sdx /dev/sdx1' or '/dev/sd[k-m]1'
282 69
 default['openstack']['block-storage']['volume']['block_devices'] = nil
283 70
 
284
-default['openstack']['block-storage']['volume']['iscsi_helper'] = 'tgtadm'
285
-default['openstack']['block-storage']['volume']['iscsi_ip_address'] = node['ipaddress']
286
-default['openstack']['block-storage']['volume']['iscsi_port'] = '3260'
287
-
288
-# Ceph/RADOS options
289
-default['openstack']['block-storage']['rbd']['cinder']['pool'] = 'volumes'
290
-default['openstack']['block-storage']['rbd']['glance']['pool'] = 'images'
291
-default['openstack']['block-storage']['rbd']['nova']['pool'] = 'instances'
292
-default['openstack']['block-storage']['rbd']['user'] = 'cinder'
293
-default['openstack']['block-storage']['rbd']['secret_uuid'] = '00000000-0000-0000-0000-000000000000'
294
-default['openstack']['block-storage']['rbd']['flatten_volume'] = false
295
-default['openstack']['block-storage']['rbd']['max_clone_depth'] = 5
296
-default['openstack']['block-storage']['rbd']['chunk_size'] = 4
297
-default['openstack']['block-storage']['rbd']['rados_timeout'] = '-1'
298
-default['openstack']['block-storage']['rbd']['conf_dir'] = '/etc/ceph/ceph.conf'
299
-
300
-# Multiple backend support
301
-# Allow multiple backends configured in cinder.conf
302
-# For example: {
303
-#                'lvm1' => {
304
-#                  'volume_driver': 'cinder.volume.drivers.lvm.LVMISCSIDriver',
305
-#                  'volume_backend_name': 'lvm-backend-1'
306
-#                }
307
-#                'lvm2' => {
308
-#                  'volume_driver': 'cinder.volume.drivers.lvm.LVMISCSIDriver',
309
-#                  'volume_backend_name': 'lvm-backend-2'
310
-#                }
311
-#              }
312
-default['openstack']['block-storage']['volume']['multi_backend'] = nil
313
-
314
-# Default volume-type for volumes to be created as when client does not request
315
-# a specific type.  Volume types are configured from cinder-client and
316
-# will reference the backend name.
317
-default['openstack']['block-storage']['volume']['default_volume_type'] = nil
318
-
319
-# Misc option support
320
-# Allow additional strings to be added to cinder.conf
321
-# For example: ['# Comment', 'key=value']
322
-default['openstack']['block-storage']['misc_cinder'] = []
323
-
324
-# Default lock_path
325
-# The lock_path normally uses /var/lock/cinder, but it's does not work
326
-# in cases like systemd, so setting lock_path to $state_path/lock like
327
-# in nova and neutron.
328
-default['openstack']['block-storage']['lock_path'] =
329
-  "#{node['openstack']['block-storage']['volume']['state_path']}/lock"
330
-
331
-# Whether to enable cinder v1 api or not
332
-default['openstack']['block-storage']['enable_v1_api'] = 'False'
333
-
334
-# Whether to enable cinder v2 api or not
335
-default['openstack']['block-storage']['enable_v2_api'] = 'True'
336
-
337
-# The full class name of the key manager api class
338
-default['openstack']['block-storage']['keymgr']['api_class'] = 'cinder.keymgr.conf_key_mgr.ConfKeyManager'
339
-
340
-# Fixed key returned by key manager, specified in hex
341
-default['openstack']['block-storage']['keymgr']['fixed_key'] = nil
71
+default['openstack']['block-storage']['user'] = 'cinder'
72
+default['openstack']['block-storage']['group'] = 'cinder'
342 73
 
343 74
 case platform_family
344
-when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
75
+when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
345 76
   # operating system user and group names
346
-  default['openstack']['block-storage']['user'] = 'cinder'
347
-  default['openstack']['block-storage']['group'] = 'cinder'
348 77
   default['openstack']['block-storage']['volume']['iscsi_helper'] = 'lioadm'
349
-
350 78
   default['openstack']['block-storage']['platform'] = {
351 79
     'cinder_common_packages' => ['openstack-cinder'],
352 80
     'cinder_api_packages' => ['python-cinderclient'],
@@ -368,39 +96,12 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
368 96
     'cinder_flashsystem_packages' => ['sysfsutils'],
369 97
     'package_overrides' => ''
370 98
   }
371
-when 'suse'
372
-  # operating system user and group names
373
-  default['openstack']['block-storage']['user'] = 'openstack-cinder'
374
-  default['openstack']['block-storage']['group'] = 'openstack-cinder'
375
-  default['openstack']['block-storage']['platform'] = {
376
-    'cinder_common_packages' => ['openstack-cinder'],
377
-    'cinder_api_packages' => ['openstack-cinder-api'],
378
-    'cinder_api_service' => 'openstack-cinder-api',
379
-    'cinder_client_packages' => ['python-cinderclient'],
380
-    'cinder_scheduler_packages' => ['openstack-cinder-scheduler'],
381
-    'cinder_scheduler_service' => 'openstack-cinder-scheduler',
382
-    'cinder_backup_packages' => ['openstack-cinder-backup'],
383
-    'cinder_backup_service' => 'openstack-cinder-backup',
384
-    'cinder_volume_packages' => ['openstack-cinder-volume', 'qemu-img'],
385
-    'cinder_volume_service' => 'openstack-cinder-volume',
386
-    'cinder_ceph_packages' => ['python-ceph', 'ceph-common'],
387
-    'cinder_iscsitarget_packages' => ['tgt'],
388
-    'cinder_iscsitarget_service' => 'tgtd',
389
-    'cinder_nfs_packages' => ['nfs-utils'],
390
-    'cinder_emc_packages' => ['python-pywbem'],
391
-    'cinder_svc_packages' => ['sysfsutils'],
392
-    'cinder_lvm_packages' => ['lvm2'],
393
-    'cinder_flashsystem_packages' => ['sysfsutils']
394
-  }
395 99
 when 'debian'
396 100
   # operating system user and group names
397
-  default['openstack']['block-storage']['user'] = 'cinder'
398
-  default['openstack']['block-storage']['group'] = 'cinder'
399 101
   default['openstack']['block-storage']['platform'] = {
400 102
     'cinder_common_packages' => ['cinder-common'],
401 103
     'cinder_api_packages' => ['cinder-api', 'python-cinderclient'],
402 104
     'cinder_api_service' => 'cinder-api',
403
-    'cinder_client_packages' => ['python-cinderclient'],
404 105
     'cinder_volume_packages' => ['cinder-volume', 'qemu-utils'],
405 106
     'cinder_volume_service' => 'cinder-volume',
406 107
     'cinder_scheduler_packages' => ['cinder-scheduler'],
@@ -419,33 +120,26 @@ when 'debian'
419 120
   }
420 121
 end
421 122
 
422
-# Attributes for cinder-backup service
423
-default['openstack']['block-storage']['backup']['driver'] = 'cinder.backup.drivers.swift'
123
+# ******************** OpenStack Volume Endpoints *****************************
124
+
125
+# The OpenStack Volume (Cinder) API endpoint
126
+%w(public internal admin).each do |ep_type|
127
+  default['openstack']['endpoints']['block-storage'][ep_type]['scheme'] = 'http'
128
+  default['openstack']['endpoints']['block-storage'][ep_type]['path'] = '/v2/%(tenant_id)s'
129
+  %w(endpoints bind_service).each do |type|
130
+    default['openstack'][type]['block-storage'][ep_type]['host'] = '127.0.0.1'
131
+    default['openstack'][type]['block-storage'][ep_type]['port'] = '8776'
132
+  end
133
+end
424 134
 
425
-# Swift support
426
-# The URL of Swift endpoint (string value)
427
-default['openstack']['block-storage']['backup']['swift']['url'] = nil
428
-# Info to match when looking for swift in the service catalog
429
-default['openstack']['block-storage']['backup']['swift']['catalog_info'] = 'object-store:swift:publicURL'
430
-# Swift authentication mechanism (string value)
431
-default['openstack']['block-storage']['backup']['swift']['auth'] = 'per_user'
432
-# Swift authentication version
433
-default['openstack']['block-storage']['backup']['swift']['auth_version'] = 1
434
-# Swift user name
435
-default['openstack']['block-storage']['backup']['swift']['user'] = nil
436
-# Swift tenant/account name. Required when connecting
437
-default['openstack']['block-storage']['backup']['swift']['tenant'] = nil
438
-# Swift key for authentication (string value)
439
-default['openstack']['block-storage']['backup']['swift']['key'] = nil
440
-# The default Swift container to use
441
-default['openstack']['block-storage']['backup']['swift']['container'] = 'volumebackups'
442
-# The size in bytes of Swift backup objects
443
-default['openstack']['block-storage']['backup']['swift']['object_size'] = 52428800
444
-# The size in bytes that changes are tracked for incremental backups
445
-default['openstack']['block-storage']['backup']['swift']['block_size'] = 32768
446
-# The number of retries to make for Swift operations
447
-default['openstack']['block-storage']['backup']['swift']['retry_attempts'] = 3
448
-# The backoff time in seconds between Swift retries
449
-default['openstack']['block-storage']['backup']['swift']['retry_backoff'] = 2
450
-# Enable or Disable the timer to send the periodic progress notifications to Ceilometer when backing up the volume to the Swift backend storage.
451
-default['openstack']['block-storage']['backup']['swift']['enable_progress_timer'] = 'True'
135
+# ============================= rootwrap Configuration ===================
136
+# use cinder root wrap
137
+default['openstack']['block-storage']['use_rootwrap'] = true
138
+# rootwrap.conf
139
+default['openstack']['block-storage']['rootwrap']['conf'].tap do |conf|
140
+  conf['DEFAULT']['filters_path'] = '/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap'
141
+  conf['DEFAULT']['exec_dirs'] = '/sbin,/usr/sbin,/bin,/usr/bin'
142
+  conf['DEFAULT']['use_syslog'] = false
143
+  conf['DEFAULT']['syslog_log_facility'] = 'syslog'
144
+  conf['DEFAULT']['syslog_log_level'] = 'ERROR'
145
+end

+ 5
- 6
metadata.rb View File

@@ -5,7 +5,7 @@ maintainer_email 'openstack-dev@lists.openstack.org'
5 5
 license 'Apache 2.0'
6 6
 description 'The OpenStack Advanced Volume Management service Cinder.'
7 7
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
8
-version '12.0.0'
8
+version '13.0.0'
9 9
 
10 10
 recipe 'openstack-block-storage::api', 'Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone'
11 11
 recipe 'openstack-block-storage::client', 'Install packages required for cinder client'
@@ -15,14 +15,13 @@ recipe 'openstack-block-storage::scheduler', 'Installs the cinder-scheduler serv
15 15
 recipe 'openstack-block-storage::volume', 'Installs the cinder-volume service and sets up the iscsi helper'
16 16
 recipe 'openstack-block-storage::backup', 'Installs the cinder-backup service'
17 17
 
18
-%w(ubuntu fedora redhat centos suse).each do |os|
18
+%w(ubuntu redhat centos).each do |os|
19 19
   supports os
20 20
 end
21 21
 
22 22
 depends 'apt', '~> 2.8'
23
-depends 'openstack-common', '>= 12.0.0'
24
-depends 'openstack-identity', '>= 12.0.0'
25
-depends 'openstack-image', '>= 12.0.0'
23
+depends 'openstack-common', '>= 13.0.0'
24
+depends 'openstack-identity', '>= 13.0.0'
25
+depends 'openstack-image', '>= 13.0.0'
26 26
 depends 'selinux', '~> 0.9.0'
27 27
 depends 'python', '~> 1.4.6'
28
-depends 'ceph', '>= 0.8.1'

+ 8
- 5
recipes/api.rb View File

@@ -20,8 +20,8 @@
20 20
 # See the License for the specific language governing permissions and
21 21
 # limitations under the License.
22 22
 #
23
-
24
-class ::Chef::Recipe # rubocop:disable Documentation
23
+# Make Openstack object available in Chef::Recipe
24
+class ::Chef::Recipe
25 25
   include ::Openstack
26 26
 end
27 27
 
@@ -43,9 +43,10 @@ node['openstack']['db']['python_packages'][db_type].each do |pkg|
43 43
   end
44 44
 end
45 45
 
46
-directory ::File.dirname(node['openstack']['block-storage']['api']['auth']['cache_dir']) do
46
+directory node['openstack']['block-storage']['conf']['keystone_authtoken']['signing_dir'] do
47 47
   owner node['openstack']['block-storage']['user']
48 48
   group node['openstack']['block-storage']['group']
49
+  recursive true
49 50
   mode 00700
50 51
 end
51 52
 
@@ -53,7 +54,10 @@ service 'cinder-api' do
53 54
   service_name platform_options['cinder_api_service']
54 55
   supports status: true, restart: true
55 56
   action :enable
56
-  subscribes :restart, 'template[/etc/cinder/cinder.conf]'
57
+  subscribes :restart, [
58
+    'template[/etc/cinder/cinder.conf]',
59
+    'remote_file[/etc/cinder/policy.json]'
60
+  ]
57 61
 end
58 62
 
59 63
 execute 'cinder-manage db sync' do
@@ -67,6 +71,5 @@ if node['openstack']['block-storage']['policyfile_url']
67 71
     owner node['openstack']['block-storage']['user']
68 72
     group node['openstack']['block-storage']['group']
69 73
     mode 00644
70
-    notifies :restart, 'service[cinder-api]'
71 74
   end
72 75
 end

+ 0
- 2
recipes/backup.rb View File

@@ -16,8 +16,6 @@
16 16
 # limitations under the License.
17 17
 #
18 18
 
19
-return unless node['openstack']['block-storage']['backup']['enabled']
20
-
21 19
 include_recipe 'openstack-block-storage::cinder-common'
22 20
 
23 21
 platform_options = node['openstack']['block-storage']['platform']

+ 56
- 78
recipes/cinder-common.rb View File

@@ -11,9 +11,8 @@
11 11
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 12
 # See the License for the specific language governing permissions and
13 13
 # limitations under the License.
14
-#
15
-
16
-class ::Chef::Recipe # rubocop:disable Documentation
14
+# Make Openstack object available in Chef::Recipe
15
+class ::Chef::Recipe
17 16
   include ::Openstack
18 17
 end
19 18
 
@@ -32,39 +31,32 @@ end
32 31
 
33 32
 db_user = node['openstack']['db']['block-storage']['username']
34 33
 db_pass = get_password 'db', 'cinder'
35
-sql_connection = db_uri('block-storage', db_user, db_pass)
36
-if node['openstack']['endpoints']['db']['enabled_slave']
37
-  slave_connection = db_uri('block-storage', db_user, db_pass, true)
38
-end
34
+node.default['openstack']['block-storage']['conf_secrets']
35
+  .[]('database')['connection'] =
36
+  db_uri('block-storage', db_user, db_pass)
39 37
 
40
-mq_service_type = node['openstack']['mq']['block-storage']['service_type']
41
-
42
-if mq_service_type == 'rabbitmq'
43
-  if node['openstack']['mq']['block-storage']['rabbit']['ha']
44
-    rabbit_hosts = rabbit_servers
45
-  end
46
-  mq_password = get_password 'user', node['openstack']['mq']['block-storage']['rabbit']['userid']
47
-elsif mq_service_type == 'qpid'
48
-  mq_password = get_password 'user', node['openstack']['mq']['block-storage']['qpid']['username']
38
+if node['openstack']['endpoints']['db']['enabled_slave']
39
+  node.default['openstack']['block-storage']['conf_secrets']
40
+    .[]('database')['slave_connection'] =
41
+    db_uri('block-storage', db_user, db_pass, true)
49 42
 end
50 43
 
51
-case node['openstack']['block-storage']['volume']['driver']
52
-when 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver'
53
-  if node['openstack']['block-storage']['storwize']['san_private_key'].to_s.empty?
54
-    storwize_pass = get_password 'user', node['openstack']['block-storage']['storwize']['san_login']
55
-  end
56
-when 'cinder.volume.drivers.solidfire.SolidFire'
57
-  solidfire_pass = get_password 'user', node['openstack']['block-storage']['solidfire']['san_login']
58
-when 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver'
59
-  flashsystem_pass = get_password 'user', node['openstack']['block-storage']['flashsystem']['san_login']
60
-when 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver'
61
-  ibmnas_pass = get_password 'user', node['openstack']['block-storage']['ibmnas']['nas_login']
62
-when 'cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver'
63
-  vmware_host_pass = get_password 'token', node['openstack']['block-storage']['vmware']['secret_name']
44
+if node['openstack']['block-storage']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
45
+  user = node['openstack']['mq']['block-storage']['rabbit']['userid']
46
+  node.default['openstack']['block-storage']['conf_secrets']
47
+    .[]('oslo_messaging_rabbit')['rabbit_userid'] = user
48
+  node.default['openstack']['block-storage']['conf_secrets']
49
+    .[]('oslo_messaging_rabbit')['rabbit_password'] =
50
+    get_password 'user', user
64 51
 end
65 52
 
66
-glance_api_endpoint = internal_endpoint 'image-api'
67
-cinder_api_bind = endpoint 'block-storage-api-bind'
53
+glance_api_endpoint = internal_endpoint 'image_api'
54
+cinder_api_bind = node['openstack']['bind_service']['block-storage']['public']
55
+identity_endpoint = public_endpoint 'identity'
56
+node.default['openstack']['block-storage']['conf_secrets']
57
+  .[]('keystone_authtoken')['password'] =
58
+  get_password 'service', 'openstack-block-storage'
59
+auth_url = auth_uri_transform(identity_endpoint.to_s, node['openstack']['api']['auth']['version'])
68 60
 
69 61
 directory '/etc/cinder' do
70 62
   group node['openstack']['block-storage']['group']
@@ -73,67 +65,53 @@ directory '/etc/cinder' do
73 65
   action :create
74 66
 end
75 67
 
76
-multi_backend_sections = {}
77
-multi_backend = node['openstack']['block-storage']['volume']['multi_backend']
78
-if multi_backend.nil?
79
-  enabled_drivers = [node['openstack']['block-storage']['volume']['driver']]
80
-else
81
-  enabled_drivers = []
82
-  multi_backend.each do |drv, options|
83
-    optlines = []
84
-    options.each do |optkey, optvalue|
85
-      optlines.push "#{optkey} = #{optvalue}"
86
-      enabled_drivers.push optvalue if optkey == 'volume_driver'
87
-    end
88
-    multi_backend_sections[drv] = optlines
89
-  end
68
+node.default['openstack']['block-storage']['conf'].tap do |conf|
69
+  conf['DEFAULT']['glance_host'] = glance_api_endpoint.host
70
+  conf['DEFAULT']['glance_port'] = glance_api_endpoint.port
71
+  conf['DEFAULT']['glance_api_servers'] = "#{glance_api_endpoint.scheme}://#{glance_api_endpoint.host}:#{glance_api_endpoint.port}"
72
+  conf['DEFAULT']['osapi_volume_listen'] = cinder_api_bind.host
73
+  conf['DEFAULT']['osapi_volume_listen_port'] = cinder_api_bind.port
74
+  conf['keystone_authtoken']['auth_url'] = auth_url
90 75
 end
91 76
 
92
-identity_endpoint = internal_endpoint 'identity-internal'
93
-identity_admin_endpoint = admin_endpoint 'identity-admin'
94
-service_pass = get_password 'service', 'openstack-block-storage'
95
-
96
-auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['block-storage']['api']['auth']['version'])
97
-identity_uri = identity_uri_transform(identity_admin_endpoint)
77
+# merge all config options and secrets to be used in the nova.conf.erb
78
+cinder_conf_options = merge_config_options 'block-storage'
98 79
 
99 80
 template '/etc/cinder/cinder.conf' do
100
-  source 'cinder.conf.erb'
81
+  source 'openstack-service.conf.erb'
82
+  cookbook 'openstack-common'
101 83
   group node['openstack']['block-storage']['group']
102 84
   owner node['openstack']['block-storage']['user']
103 85
   mode 00640
104 86
   variables(
105
-    sql_connection: sql_connection,
106
-    slave_connection: slave_connection,
107
-    mq_service_type: mq_service_type,
108
-    mq_password: mq_password,
109
-    rabbit_hosts: rabbit_hosts,
110
-    glance_scheme: glance_api_endpoint.scheme,
111
-    glance_host: glance_api_endpoint.host,
112
-    glance_port: glance_api_endpoint.port,
113
-    ibmnas_pass: ibmnas_pass,
114
-    solidfire_pass: solidfire_pass,
115
-    flashsystem_pass: flashsystem_pass,
116
-    storwize_pass: storwize_pass,
117
-    volume_api_bind_address: cinder_api_bind.host,
118
-    volume_api_bind_port: cinder_api_bind.port,
119
-    vmware_host_pass: vmware_host_pass,
120
-    enabled_drivers: enabled_drivers,
121
-    multi_backend_sections: multi_backend_sections,
122
-    auth_uri: auth_uri,
123
-    identity_uri: identity_uri,
124
-    service_pass: service_pass
87
+    service_config: cinder_conf_options
125 88
   )
126 89
 end
127 90
 
128
-directory node['openstack']['block-storage']['lock_path'] do
91
+# delete all secrets saved in the attribute
92
+# node['openstack']['block-storage']['conf_secrets'] after creating the cinder.conf
93
+ruby_block "delete all attributes in node['openstack']['block-storage']['conf_secrets']" do
94
+  block do
95
+    node.rm(:openstack, :'block-storage', :conf_secrets)
96
+  end
97
+end
98
+
99
+directory node['openstack']['block-storage']['conf']['oslo_concurrency']['lock_path'] do
129 100
   group node['openstack']['block-storage']['group']
130 101
   owner node['openstack']['block-storage']['user']
102
+  recursive true
131 103
   mode 00755
132 104
 end
133 105
 
134
-template '/etc/cinder/rootwrap.conf' do
135
-  source 'rootwrap.conf.erb'
136
-  owner 'root'
137
-  group 'root'
138
-  mode 00644
106
+if node['openstack']['block-storage']['use_rootwrap']
107
+  template '/etc/cinder/rootwrap.conf' do
108
+    source 'openstack-service.conf.erb'
109
+    cookbook 'openstack-common'
110
+    owner 'root'
111
+    group 'root'
112
+    mode 00644
113
+    variables(
114
+      service_config: node['openstack']['block-storage']['rootwrap']['conf']
115
+    )
116
+  end
139 117
 end

+ 2
- 3
recipes/client.rb View File

@@ -17,8 +17,8 @@
17 17
 # See the License for the specific language governing permissions and
18 18
 # limitations under the License.
19 19
 #
20
-
21
-class ::Chef::Recipe # rubocop:disable Documentation
20
+# Make Openstack object available in Chef::Recipe
21
+class ::Chef::Recipe
22 22
   include ::Openstack
23 23
 end
24 24
 
@@ -26,7 +26,6 @@ platform_options = node['openstack']['block-storage']['platform']
26 26
 platform_options['cinder_client_packages'].each do |pkg|
27 27
   package pkg do
28 28
     options platform_options['package_overrides']
29
-
30 29
     action :upgrade
31 30
   end
32 31
 end

+ 40
- 7
recipes/identity_registration.rb View File

@@ -21,17 +21,17 @@
21 21
 #
22 22
 
23 23
 require 'uri'
24
-
25
-class ::Chef::Recipe # rubocop:disable Documentation
24
+# Make Openstack object available in Chef::Recipe
25
+class ::Chef::Recipe
26 26
   include ::Openstack
27 27
 end
28 28
 
29
-identity_admin_endpoint = admin_endpoint 'identity-admin'
29
+identity_admin_endpoint = admin_endpoint 'identity'
30 30
 bootstrap_token = get_password 'token', 'openstack_identity_bootstrap_token'
31 31
 auth_uri = ::URI.decode identity_admin_endpoint.to_s
32
-admin_cinder_api_endpoint = admin_endpoint 'block-storage-api'
33
-internal_cinder_api_endpoint = internal_endpoint 'block-storage-api'
34
-public_cinder_api_endpoint = public_endpoint 'block-storage-api'
32
+admin_cinder_api_endpoint = admin_endpoint 'block-storage'
33
+internal_cinder_api_endpoint = internal_endpoint 'block-storage'
34
+public_cinder_api_endpoint = public_endpoint 'block-storage'
35 35
 service_pass = get_password 'service', 'openstack-block-storage'
36 36
 region = node['openstack']['block-storage']['region']
37 37
 service_tenant_name = node['openstack']['block-storage']['service_tenant_name']
@@ -45,7 +45,6 @@ openstack_identity_register 'Register Service Tenant' do
45 45
   bootstrap_token bootstrap_token
46 46
   tenant_name service_tenant_name
47 47
   tenant_description 'Service Tenant'
48
-
49 48
   action :create_tenant
50 49
 end
51 50
 
@@ -75,6 +74,40 @@ openstack_identity_register 'Register Cinder V2 Volume Endpoint' do
75 74
   action :create_endpoint
76 75
 end
77 76
 
77
+# --------------------- WORKAROUND --------------------------------------#
78
+# Currently this bug is still open
79
+# (https://bugs.launchpad.net/horizon/+bug/1415712) and we need to register and
80
+# enable the cinder v1 api to make it available via the dashboard. This should
81
+# be removed with the final mitaka release.
82
+
83
+openstack_identity_register 'Register Cinder V1 Volume Service' do
84
+  auth_uri auth_uri
85
+  bootstrap_token bootstrap_token
86
+  service_name ((service_name).gsub(/v2/, ''))
87
+  service_type ((service_type).gsub(/v2/, ''))
88
+  service_description 'Cinder Volume Service V1'
89
+  endpoint_region region
90
+  endpoint_adminurl ((::URI.decode admin_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
91
+  endpoint_internalurl ((::URI.decode internal_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
92
+  endpoint_publicurl ((::URI.decode public_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
93
+  action :create_service
94
+end
95
+
96
+openstack_identity_register 'Register Cinder V1 Volume Endpoint' do
97
+  auth_uri auth_uri
98
+  bootstrap_token bootstrap_token
99
+  service_name ((service_name).gsub(/v2/, ''))
100
+  service_type ((service_type).gsub(/v2/, ''))
101
+  service_description 'Cinder Volume Service V1'
102
+  endpoint_region region
103
+  endpoint_adminurl ((::URI.decode admin_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
104
+  endpoint_internalurl ((::URI.decode internal_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
105
+  endpoint_publicurl ((::URI.decode public_cinder_api_endpoint.to_s).gsub(/v2/, 'v1'))
106
+  action :create_endpoint
107
+end
108
+
109
+# --------------------- WORKAROUND --------------------------------------#
110
+
78 111
 openstack_identity_register 'Register Cinder Service User' do
79 112
   auth_uri auth_uri
80 113
   bootstrap_token bootstrap_token

+ 0
- 22
recipes/scheduler.rb View File

@@ -28,7 +28,6 @@ platform_options = node['openstack']['block-storage']['platform']
28 28
 platform_options['cinder_scheduler_packages'].each do |pkg|
29 29
   package pkg do
30 30
     options platform_options['package_overrides']
31
-
32 31
     action :upgrade
33 32
   end
34 33
 end
@@ -46,24 +45,3 @@ service 'cinder-scheduler' do
46 45
   action [:enable, :start]
47 46
   subscribes :restart, 'template[/etc/cinder/cinder.conf]'
48 47
 end
49
-
50
-audit_bin_dir = platform_family?('debian') ? '/usr/bin' : '/usr/local/bin'
51
-audit_log = node['openstack']['block-storage']['cron']['audit_logfile']
52
-
53
-if node['openstack']['telemetry']
54
-  scheduler_role = node['openstack']['block-storage']['scheduler_role']
55
-  results = search(:node, "roles:#{scheduler_role}")
56
-  cron_node = results.map { |a| a.name }.sort[0]
57
-  Chef::Log.debug("Volume audit cron node: #{cron_node}")
58
-
59
-  cron 'cinder-volume-usage-audit' do
60
-    day node['openstack']['block-storage']['cron']['day'] || '*'
61
-    hour node['openstack']['block-storage']['cron']['hour'] || '*'
62
-    minute node['openstack']['block-storage']['cron']['minute']
63
-    month node['openstack']['block-storage']['cron']['month'] || '*'
64
-    weekday node['openstack']['block-storage']['cron']['weekday'] || '*'
65
-    command "#{audit_bin_dir}/cinder-volume-usage-audit > #{audit_log} 2>&1"
66
-    action cron_node == node.name ? :create : :delete
67
-    user node['openstack']['block-storage']['user']
68
-  end
69
-end

+ 0
- 203
recipes/volume.rb View File

@@ -52,209 +52,6 @@ platform_options['cinder_iscsitarget_packages'].each do |pkg|
52 52
   end
53 53
 end
54 54
 
55
-case node['openstack']['block-storage']['volume']['driver']
56
-when 'cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver'
57
-  node.override['openstack']['block-storage']['netapp']['dfm_password'] = get_password 'service', 'netapp'
58
-
59
-when 'cinder.volume.drivers.rbd.RBDDriver'
60
-  include_recipe 'ceph'
61
-
62
-  cinder_pool = node['openstack']['block-storage']['rbd']['cinder']['pool']
63
-  nova_pool = node['openstack']['block-storage']['rbd']['nova']['pool']
64
-  glance_pool =  node['openstack']['block-storage']['rbd']['glance']['pool']
65
-
66
-  caps = { 'mon' => 'allow r',
67
-           'osd' => "allow class-read object_prefix rbd_children, allow rwx pool=#{cinder_pool}, allow rwx pool=#{nova_pool}, allow rx pool=#{glance_pool}" }
68
-
69
-  ceph_client node['openstack']['block-storage']['rbd']['user'] do
70
-    name node['openstack']['block-storage']['rbd']['user']
71
-    caps caps
72
-    keyname "client.#{node['openstack']['block-storage']['rbd']['user']}"
73
-    filename "/etc/ceph/ceph.client.#{node['openstack']['block-storage']['rbd']['user']}.keyring"
74
-    owner node['openstack']['block-storage']['user']
75
-    group node['openstack']['block-storage']['group']
76
-
77
-    action :add
78
-    notifies :restart, 'service[cinder-volume]'
79
-  end
80
-
81
-when 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
82
-  node.override['openstack']['block-storage']['netapp']['netapp_server_password'] = get_password 'service', 'netapp-filer'
83
-
84
-  directory node['openstack']['block-storage']['nfs']['mount_point_base'] do
85
-    owner node['openstack']['block-storage']['user']
86
-    group node['openstack']['block-storage']['group']
87
-    action :create
88
-  end
89
-
90
-  template node['openstack']['block-storage']['nfs']['shares_config'] do
91
-    source 'shares.conf.erb'
92
-    mode '0600'
93
-    owner node['openstack']['block-storage']['user']
94
-    group node['openstack']['block-storage']['group']
95
-    variables(
96
-      host: node['openstack']['block-storage']['netapp']['netapp_server_hostname'],
97
-      export: node['openstack']['block-storage']['netapp']['export']
98
-    )
99
-    notifies :restart, 'service[cinder-volume]'
100
-  end
101
-
102
-  platform_options['cinder_nfs_packages'].each do |pkg|
103
-    package pkg do
104
-      options platform_options['package_overrides']
105
-      action :upgrade
106
-    end
107
-  end
108
-
109
-when 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver'
110
-  san_private_key = node['openstack']['block-storage']['storwize']['san_private_key']
111
-  san_private_key_url = node['openstack']['block-storage']['storwize']['san_private_key_url']
112
-
113
-  if san_private_key && san_private_key_url
114
-    remote_file san_private_key do
115
-      source san_private_key_url
116
-      mode '0400'
117
-      owner node['openstack']['block-storage']['user']
118
-      group node['openstack']['block-storage']['group']
119
-    end
120
-  end
121
-
122
-  platform_options['cinder_svc_packages'].each do |pkg|
123
-    package pkg do
124
-      options platform_options['package_overrides']
125
-      action :upgrade
126
-    end
127
-  end
128
-
129
-when 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver'
130
-  platform_options['cinder_flashsystem_packages'].each do |pkg|
131
-    package pkg do
132
-      options platform_options['package_overrides']
133
-      action :upgrade
134
-    end
135
-  end
136
-
137
-when 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
138
-  directory node['openstack']['block-storage']['gpfs']['gpfs_mount_point_base'] do
139
-    mode '0755'
140
-    owner node['openstack']['block-storage']['user']
141
-    group node['openstack']['block-storage']['group']
142
-    recursive true
143
-  end
144
-  multi_backend = node['openstack']['block-storage']['volume']['multi_backend']
145
-  unless multi_backend.nil?
146
-    multi_backend.each do |_drv, options|
147
-      options.select { |optkey, _optvalue| optkey == 'gpfs_mount_point_base' }.each do |_optkey, optvalue|
148
-        directory optvalue do
149
-          mode '0755'
150
-          owner node['openstack']['block-storage']['user']
151
-          group node['openstack']['block-storage']['group']
152
-          recursive true
153
-        end
154
-      end
155
-    end
156
-  end
157
-
158
-when 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver'
159
-  directory node['openstack']['block-storage']['ibmnas']['mount_point_base'] do
160
-    owner node['openstack']['block-storage']['user']
161
-    group node['openstack']['block-storage']['group']
162
-    mode '0755'
163
-    recursive true
164
-    action :create
165
-  end
166
-
167
-  platform_options['cinder_nfs_packages'].each do |pkg|
168
-    package pkg do
169
-      options platform_options['package_overrides']
170
-      action :upgrade
171
-    end
172
-  end
173
-
174
-  template node['openstack']['block-storage']['ibmnas']['shares_config'] do
175
-    source 'nfs_shares.conf.erb'
176
-    mode '0600'
177
-    owner node['openstack']['block-storage']['user']
178
-    group node['openstack']['block-storage']['group']
179
-    variables(
180
-      host: node['openstack']['block-storage']['ibmnas']['nas_access_ip'],
181
-      export: node['openstack']['block-storage']['ibmnas']['export']
182
-    )
183
-    notifies :restart, 'service[cinder-volume]'
184
-  end
185
-
186
-when 'cinder.volume.drivers.lvm.LVMVolumeDriver'
187
-
188
-  platform_options['cinder_lvm_packages'].each do |pkg|
189
-    package pkg do
190
-      options platform_options['package_overrides']
191
-      action :upgrade
192
-    end
193
-  end
194
-
195
-  if node['openstack']['block-storage']['volume']['create_volume_group']
196
-    vg_name = node['openstack']['block-storage']['volume']['volume_group']
197
-
198
-    case node['openstack']['block-storage']['volume']['create_volume_group_type']
199
-    when 'file'
200
-      volume_size = node['openstack']['block-storage']['volume']['volume_group_size']
201
-      seek_count = volume_size.to_i * 1024
202
-      vg_file = "#{node['openstack']['block-storage']['volume']['state_path']}/#{vg_name}.img"
203
-
204
-      # create volume group
205
-      execute 'Create Cinder volume group' do
206
-        command "dd if=/dev/zero of=#{vg_file} bs=1M seek=#{seek_count} count=0; vgcreate #{vg_name} $(losetup --show -f #{vg_file})"
207
-        action :run
208
-        not_if "vgs #{vg_name}"
209
-      end
210
-
211
-      template '/etc/init.d/cinder-group-active' do
212
-        source 'cinder-group-active.erb'
213
-        mode '755'
214
-        variables(
215
-          volume_name: vg_name,
216
-          volume_file: vg_file
217
-        )
218
-        notifies :start, 'service[cinder-group-active]', :immediately
219
-      end
220
-
221
-      service 'cinder-group-active' do
222
-        service_name 'cinder-group-active'
223
-
224
-        action [:enable, :start]
225
-      end
226
-
227
-    when 'block_devices'
228
-
229
-      block_devices = node['openstack']['block-storage']['volume']['block_devices']
230
-      execute 'Create Cinder volume group with block devices' do
231
-        command "pvcreate #{block_devices}; vgcreate #{vg_name} #{block_devices}"
232
-        action :run
233
-        not_if "vgs #{vg_name}"
234
-      end
235
-    end
236
-  end
237
-
238
-when 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
239
-  platform_options['cinder_emc_packages'].each do |pkg|
240
-    package pkg do
241
-      options platform_options['package_overrides']
242
-      action :upgrade
243
-    end
244
-  end
245
-
246
-  ecom_password = get_password('user', node['openstack']['block-storage']['emc']['EcomUserName'])
247
-
248
-  template node['openstack']['block-storage']['emc']['cinder_emc_config_file'] do
249
-    source 'cinder_emc_config.xml.erb'
250
-    variables(
251
-      ecom_password: ecom_password
252
-    )
253
-    mode 00644
254
-    notifies :restart, 'service[iscsitarget]', :immediately
255
-  end
256
-end
257
-
258 55
 service 'cinder-volume' do
259 56
   service_name platform_options['cinder_volume_service']
260 57
   supports status: true, restart: true

+ 66
- 0
recipes/volume_driver_lvm.rb View File

@@ -0,0 +1,66 @@
1
+# encoding: UTF-8
2
+#
3
+# Cookbook Name:: openstack-block-storage
4
+# Recipe:: volume_driver_lvm
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#     http://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
19
+platform_options = node['openstack']['block-storage']['platform']
20
+platform_options['cinder_lvm_packages'].each do |pkg|
21
+  package pkg do
22
+    options platform_options['package_overrides']
23
+    action :upgrade
24
+  end
25
+end
26
+
27
+# TODO: (jklare) this whole section should be refactored and probably include an
28
+# external cookbook for managing lvm stuff
29
+
30
+vg_name = node['openstack']['block-storage']['conf']['DEFAULT']['volume_group']
31
+case node['openstack']['block-storage']['volume']['create_volume_group_type']
32
+when 'file'
33
+  volume_size = node['openstack']['block-storage']['volume']['volume_group_size']
34
+  seek_count = volume_size.to_i * 1024
35
+  vg_file = "#{node['openstack']['block-storage']['conf']['DEFAULT']['state_path']}/#{vg_name}.img"
36
+
37
+  # create volume group
38
+  execute 'Create Cinder volume group' do
39
+    command "dd if=/dev/zero of=#{vg_file} bs=1M seek=#{seek_count} count=0; vgcreate #{vg_name} $(losetup --show -f #{vg_file})"
40
+    action :run
41
+    not_if "vgs #{vg_name}"
42
+  end
43
+
44
+  template '/etc/init.d/cinder-group-active' do
45
+    source 'cinder-group-active.erb'
46
+    mode '755'
47
+    variables(
48
+      volume_name: vg_name,
49
+      volume_file: vg_file
50
+    )
51
+    notifies :start, 'service[cinder-group-active]', :immediately
52
+  end
53
+
54
+  service 'cinder-group-active' do
55
+    service_name 'cinder-group-active'
56
+    action [:enable, :start]
57
+  end
58
+
59
+when 'block_devices'
60
+  block_devices = node['openstack']['block-storage']['volume']['block_devices']
61
+  execute 'Create Cinder volume group with block devices' do
62
+    command "pvcreate #{block_devices}; vgcreate #{vg_name} #{block_devices}"
63
+    action :run
64
+    not_if "vgs #{vg_name}"
65
+  end
66
+end

+ 0
- 37
spec/api-opensuse_spec.rb View File

@@ -1,37 +0,0 @@
1
-# encoding: UTF-8
2
-#
3
-# Cookbook Name:: openstack-block-storage
4
-
5
-require_relative 'spec_helper'
6
-
7
-describe 'openstack-block-storage::api' do
8
-  describe 'suse' do
9
-    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
10
-    let(:node) { runner.node }
11
-    let(:chef_run) { runner.converge(described_recipe) }
12
-
13
-    include_context 'block-storage-stubs'
14
-
15
-    it 'upgrades cinder api package' do
16
-      expect(chef_run).to upgrade_package 'openstack-cinder-api'
17
-    end
18
-
19
-    it 'upgrades mysql python package' do
20
-      expect(chef_run).to upgrade_package 'python-mysql'
21
-    end
22
-
23
-    it 'upgrades postgresql python packages if explicitly told' do
24
-      node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
25
-
26
-      expect(chef_run).to upgrade_package 'python-psycopg2'
27
-      expect(chef_run).not_to upgrade_package 'python-mysql'
28
-    end
29
-
30
-    it 'starts cinder api on boot' do
31
-      expect(chef_run).to enable_service 'openstack-cinder-api'
32
-    end
33
-
34
-    expect_creates_cinder_conf(
35
-      'service[cinder-api]', 'openstack-cinder', 'openstack-cinder')
36
-  end
37
-end

+ 2
- 2
spec/api_spec.rb View File

@@ -35,8 +35,8 @@ describe 'openstack-block-storage::api' do
35 35
       expect(chef_run).not_to upgrade_package('python-mysqldb')
36 36
     end
37 37
 
38
-    describe '/var/cache/cinder' do
39
-      let(:dir) { chef_run.directory('/var/cache/cinder') }
38
+    describe '/var/cache/cinder/api' do
39
+      let(:dir) { chef_run.directory('/var/cache/cinder/api') }
40 40
 
41 41
       it 'should create the directory' do
42 42
         expect(chef_run).to create_directory(dir.name).with(

+ 0
- 43
spec/backup-suse_spec.rb View File

@@ -1,43 +0,0 @@
1
-# encoding: UTF-8
2
-#
3
-# Cookbook Name:: openstack-block-storage
4
-
5
-require_relative 'spec_helper'
6
-
7
-describe 'openstack-block-storage::backup' do
8
-  describe 'suse' do
9
-    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
10
-    let(:node) { runner.node }
11
-    let(:chef_run) { runner.converge(described_recipe) }
12
-
13
-    include_context 'block-storage-stubs'
14
-
15
-    describe 'enable cinder backup service' do
16
-      before do
17
-        node.set['openstack']['block-storage']['backup']['enabled'] = true
18
-      end
19
-      it 'upgrades cinder backup package' do
20
-        expect(chef_run).to upgrade_package 'openstack-cinder-backup'
21
-      end
22
-
23
-      it 'starts cinder backup' do
24
-        expect(chef_run).to start_service 'openstack-cinder-backup'
25
-      end
26
-
27
-      it 'starts cinder backup on boot' do
28
-        expect(chef_run).to enable_service 'openstack-cinder-backup'
29
-      end
30
-
31
-      it 'upgrades mysql python package' do
32
-        expect(chef_run).to upgrade_package 'python-mysql'
33
-      end
34
-
35
-      it 'upgrades postgresql python packages if explicitly told' do
36
-        node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
37
-
38
-        expect(chef_run).to upgrade_package 'python-psycopg2'
39
-        expect(chef_run).not_to upgrade_package 'python-mysql'
40
-      end
41
-    end
42
-  end
43
-end

+ 0
- 35
spec/backup_spec.rb View File

@@ -13,9 +13,6 @@ describe 'openstack-block-storage::backup' do
13 13
     include_context 'block-storage-stubs'
14 14
 
15 15
     describe 'enable cinder backup service' do
16
-      before do
17
-        node.set['openstack']['block-storage']['backup']['enabled'] = true
18
-      end
19 16
       it 'upgrades cinder backup package' do
20 17
         expect(chef_run).to upgrade_package 'cinder-backup'
21 18
       end
@@ -43,37 +40,5 @@ describe 'openstack-block-storage::backup' do
43 40
         expect(chef_run).not_to upgrade_package 'python-mysqldb'
44 41
       end
45 42
     end
46
-
47
-    describe 'disable cinder backup service' do
48
-      before do
49
-        node.set['openstack']['block-storage']['backup']['enabled'] = false
50
-      end
51
-      it 'not to upgrades cinder backup package' do
52
-        expect(chef_run).not_to upgrade_package 'cinder-backup'
53
-      end
54
-
55
-      it 'not to starts cinder backup' do
56
-        expect(chef_run).not_to start_service 'cinder-backup'
57
-      end
58
-
59
-      it 'not to starts cinder backup on boot' do
60
-        expect(chef_run).not_to enable_service 'cinder-backup'
61
-      end
62
-
63
-      it 'not to subscribes to the template change' do
64
-        expect(chef_run.service('cinder-backup')).not_to subscribe_to('template[/etc/cinder/cinder.conf]')
65
-      end
66
-
67
-      it 'not to upgrades mysql python package' do
68
-        expect(chef_run).not_to upgrade_package 'python-mysqldb'
69
-      end
70
-
71
-      it 'not to upgrades postgresql python packages if explicitly told' do
72
-        node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
73
-
74
-        expect(chef_run).not_to upgrade_package 'python-psycopg2'
75
-        expect(chef_run).not_to upgrade_package 'python-mysqldb'
76
-      end
77
-    end
78 43
   end
79 44
 end

+ 0
- 19
spec/cinder_common-suse_spec.rb View File

@@ -1,19 +0,0 @@
1
-# encoding: UTF-8
2
-#
3
-# Cookbook Name:: openstack-block-storage
4
-
5
-require_relative 'spec_helper'
6
-
7
-describe 'openstack-block-storage::cinder-common' do
8
-  describe 'suse' do
9
-    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
10
-    let(:node) { runner.node }
11
-    let(:chef_run) { runner.converge(described_recipe) }
12
-
13
-    include_context 'block-storage-stubs'
14
-
15
-    it 'upgrades the openstack-cinder package' do
16
-      expect(chef_run).to upgrade_package 'openstack-cinder'
17
-    end
18
-  end
19
-end

+ 46
- 854
spec/cinder_common_spec.rb
File diff suppressed because it is too large
View File


+ 0
- 4
spec/client_spec.rb View File

@@ -8,9 +8,5 @@ describe 'openstack-block-storage::client' do
8 8
     let(:chef_run) do
9 9
       runner.converge(described_recipe)
10 10
     end
11
-
12
-    it 'upgrades packages' do
13
-      expect(chef_run).to upgrade_package('python-cinderclient')
14
-    end
15 11
   end
16 12
 end

+ 33
- 75
spec/identity_registration_spec.rb View File

@@ -56,86 +56,14 @@ describe 'openstack-block-storage::identity_registration' do
56 56
         )
57 57
       end
58 58
 
59
-      it 'with different admin URL' do
60
-        admin_url = 'https://admin.host:123/admin_path'
61
-        general_url = 'http://general.host:456/general_path'
62
-
63
-        # Set the general endpoint
64
-        node.set['openstack']['endpoints']['block-storage-api']['uri'] = general_url
65
-        # Set the admin endpoint override
66
-        node.set['openstack']['endpoints']['admin']['block-storage-api']['uri'] = admin_url
67
-
68
-        expect(chef_run).to create_endpoint_openstack_identity_register(
69
-          'Register Cinder V2 Volume Endpoint'
70
-        ).with(
71
-          auth_uri: 'http://127.0.0.1:35357/v2.0',
72
-          bootstrap_token: 'bootstrap-token',
73
-          service_name: 'cinderv2',
74
-          service_type: 'volumev2',
75
-          service_description: 'Cinder Volume Service V2',
76
-          endpoint_region: 'RegionOne',
77
-          endpoint_adminurl: admin_url,
78
-          endpoint_internalurl: general_url,
79
-          endpoint_publicurl: general_url
80
-        )
81
-      end
82
-
83
-      it 'with different public URL' do
84
-        public_url = 'https://public.host:789/public_path'
85
-        general_url = 'http://general.host:456/general_path'
86
-
87
-        # Set the general endpoint
88
-        node.set['openstack']['endpoints']['block-storage-api']['uri'] = general_url
89
-        # Set the public endpoint override
90
-        node.set['openstack']['endpoints']['public']['block-storage-api']['uri'] = public_url
91
-
92
-        expect(chef_run).to create_endpoint_openstack_identity_register(
93
-          'Register Cinder V2 Volume Endpoint'
94
-        ).with(
95
-          auth_uri: 'http://127.0.0.1:35357/v2.0',
96
-          bootstrap_token: 'bootstrap-token',
97
-          service_name: 'cinderv2',
98
-          service_type: 'volumev2',
99
-          service_description: 'Cinder Volume Service V2',
100
-          endpoint_region: 'RegionOne',
101
-          endpoint_adminurl: general_url,
102
-          endpoint_internalurl: general_url,
103
-          endpoint_publicurl: public_url
104
-        )
105
-      end
106
-
107
-      it 'with different internal URL' do
108
-        internal_url = 'http://internal.host:456/internal_path'
109
-        general_url = 'http://general.host:456/general_path'
110
-
111
-        # Set the general endpoint
112
-        node.set['openstack']['endpoints']['block-storage-api']['uri'] = general_url
113
-        # Set the internal endpoint override
114
-        node.set['openstack']['endpoints']['internal']['block-storage-api']['uri'] = internal_url
115
-
116
-        expect(chef_run).to create_endpoint_openstack_identity_register(
117
-          'Register Cinder V2 Volume Endpoint'
118
-        ).with(
119
-          auth_uri: 'http://127.0.0.1:35357/v2.0',
120
-          bootstrap_token: 'bootstrap-token',
121
-          service_name: 'cinderv2',
122
-          service_type: 'volumev2',
123
-          service_description: 'Cinder Volume Service V2',
124
-          endpoint_region: 'RegionOne',
125
-          endpoint_adminurl: general_url,
126
-          endpoint_internalurl: internal_url,
127
-          endpoint_publicurl: general_url
128
-        )
129
-      end
130
-
131 59
       it 'with all different URLs' do
132 60
         admin_url = 'https://admin.host:123/admin_path'
133 61
         internal_url = 'http://internal.host:456/internal_path'
134 62
         public_url = 'https://public.host:789/public_path'
135 63
 
136
-        node.set['openstack']['endpoints']['internal']['block-storage-api']['uri'] = internal_url
137
-        node.set['openstack']['endpoints']['admin']['block-storage-api']['uri'] = admin_url
138
-        node.set['openstack']['endpoints']['public']['block-storage-api']['uri'] = public_url
64
+        node.set['openstack']['endpoints']['block-storage']['internal']['uri'] = internal_url
65
+        node.set['openstack']['endpoints']['block-storage']['admin']['uri'] = admin_url
66
+        node.set['openstack']['endpoints']['block-storage']['public']['uri'] = public_url
139 67
 
140 68
         expect(chef_run).to create_endpoint_openstack_identity_register(
141 69
           'Register Cinder V2 Volume Endpoint'
@@ -203,5 +131,35 @@ describe 'openstack-block-storage::identity_registration' do
203 131
         role_name: 'service'
204 132
       )
205 133
     end
134
+    it do
135
+      expect(chef_run).to create_service_openstack_identity_register(
136
+        'Register Cinder V1 Volume Service'
137
+      ).with(
138
+        auth_uri: 'http://127.0.0.1:35357/v2.0',
139
+        bootstrap_token: 'bootstrap-token',
140
+        service_name: 'cinder',
141
+        service_type: 'volume',
142
+        service_description: 'Cinder Volume Service V1',
143
+        endpoint_region: 'RegionOne',
144
+        endpoint_adminurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
145
+        endpoint_internalurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
146
+        endpoint_publicurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s'
147
+      )
148
+    end
149
+    it do
150
+      expect(chef_run).to create_endpoint_openstack_identity_register(
151
+        'Register Cinder V1 Volume Endpoint'
152
+      ).with(
153
+        auth_uri: 'http://127.0.0.1:35357/v2.0',
154
+        bootstrap_token: 'bootstrap-token',
155
+        service_name: 'cinder',
156
+        service_type: 'volume',
157
+        service_description: 'Cinder Volume Service V1',
158
+        endpoint_region: 'RegionOne',
159
+        endpoint_adminurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
160
+        endpoint_internalurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
161
+        endpoint_publicurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s'
162
+      )
163
+    end
206 164
   end
207 165
 end

+ 0
- 42
spec/scheduler-suse_spec.rb View File

@@ -1,42 +0,0 @@
1
-# encoding: UTF-8
2
-#
3
-# Cookbook Name:: openstack-block-storage
4
-
5
-require_relative 'spec_helper'
6
-
7
-describe 'openstack-block-storage::scheduler' do
8
-  describe 'suse' do
9
-    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
10
-    let(:node) { runner.node }
11
-    let(:chef_run) { runner.converge(described_recipe) }
12
-
13
-    include_context 'block-storage-stubs'
14
-
15
-    it 'upgrades cinder scheduler package' do
16
-      expect(chef_run).to upgrade_package 'openstack-cinder-scheduler'
17
-    end
18
-
19
-    it 'starts cinder scheduler' do
20
-      expect(chef_run).to start_service 'openstack-cinder-scheduler'
21
-    end
22
-
23
-    it 'starts cinder scheduler on boot' do
24
-      expect(chef_run).to enable_service 'openstack-cinder-scheduler'
25
-    end
26
-
27
-    it 'does not upgrade stevedore' do
28
-      expect(chef_run).not_to upgrade_python_pip 'stevedore'
29
-    end
30
-
31
-    it 'upgrades mysql python package' do
32
-      expect(chef_run).to upgrade_package 'python-mysql'
33
-    end
34
-
35
-    it 'upgrades postgresql python packages if explicitly told' do
36
-      node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
37
-
38
-      expect(chef_run).to upgrade_package 'python-psycopg2'
39
-      expect(chef_run).not_to upgrade_package 'python-mysql'
40
-    end
41
-  end
42
-end

+ 0
- 41
spec/scheduler_spec.rb View File

@@ -37,46 +37,5 @@ describe 'openstack-block-storage::scheduler' do
37 37
       expect(chef_run).to upgrade_package 'python-psycopg2'
38 38
       expect(chef_run).not_to upgrade_package 'python-mysqldb'
39 39
     end
40
-
41
-    it 'does not setup cron when no metering' do
42
-      expect(chef_run.cron('cinder-volume-usage-audit')).to be_nil
43
-    end
44
-
45
-    it 'creates cron metering default' do
46
-      allow_any_instance_of(Chef::Recipe).to receive(:search)
47
-        .with(:node, 'roles:os-block-storage-scheduler')
48
-        .and_return([OpenStruct.new(name: 'fauxhai.local')])
49
-      node.set['openstack']['telemetry'] = true
50
-
51
-      cron = chef_run.cron 'cinder-volume-usage-audit'
52
-      bin_str = '/usr/bin/cinder-volume-usage-audit > /var/log/cinder/audit.log'
53
-      expect(cron.command).to match(/#{bin_str}/)
54
-      crontests = [[:minute, '00'], [:hour, '*'], [:day, '*'],
55
-                   [:weekday, '*'], [:month, '*'], [:user, 'cinder']]
56
-      crontests.each do |k, v|
57
-        expect(cron.send(k)).to eq v
58
-        expect(chef_run).to create_cron('cinder-volume-usage-audit')
59
-      end
60
-      expect(cron.action).to include :create
61
-    end
62
-
63
-    it 'creates cron metering custom' do
64
-      crontests = [[:minute, '50'], [:hour, '23'], [:day, '6'],
65
-                   [:weekday, '5'], [:month, '11'], [:user, 'foobar']]
66
-      allow_any_instance_of(Chef::Recipe).to receive(:search)
67
-        .with(:node, 'roles:os-block-storage-scheduler')
68
-        .and_return([OpenStruct.new(name: 'foobar')])
69
-      node.set['openstack']['telemetry'] = true
70
-      crontests.each do |k, v|
71
-        node.set['openstack']['block-storage']['cron'][k.to_s] = v
72
-      end
73
-      node.set['openstack']['block-storage']['user'] = 'foobar'
74
-
75
-      cron = chef_run.cron 'cinder-volume-usage-audit'
76
-      crontests.each do |k, v|
77
-        expect(cron.send(k)).to eq v
78
-      end
79
-      expect(cron.action).to include :delete
80
-    end
81 40
   end
82 41
 end

+ 1
- 6
spec/spec_helper.rb View File

@@ -10,11 +10,6 @@ ChefSpec::Coverage.start! { add_filter 'openstack-block-storage' }
10 10
 require 'chef/application'
11 11
 
12 12
 LOG_LEVEL = :fatal
13
-SUSE_OPTS = {
14
-  platform: 'suse',
15
-  version: '11.3',
16
-  log_level: LOG_LEVEL
17
-}
18 13
 REDHAT_OPTS = {
19 14
   platform: 'redhat',
20 15
   version: '7.1',
@@ -95,7 +90,7 @@ def expect_runs_openstack_common_logging_recipe
95 90
   end
96 91
 end
97 92
 
98
-def expect_creates_cinder_conf(service, user, group, action = :restart) # rubocop:disable MethodLength
93
+def expect_creates_cinder_conf(service, user, group, action = :restart)
99 94
   describe 'cinder.conf' do
100 95
     let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
101 96
 

+ 0
- 154
spec/volume-redhat_spec.rb View File

@@ -44,159 +44,5 @@ describe 'openstack-block-storage::volume' do
44 44
         expect(chef_run).to enable_service('target')
45 45
       end
46 46
     end
47
-
48
-    context 'IBMNAS Driver' do
49
-      let(:file) { chef_run.template('/etc/cinder/nfs_shares.conf') }
50
-      before do
51
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver'
52
-        node.set['openstack']['block-storage']['ibmnas']['nas_access_ip'] = '127.0.0.1'
53
-        node.set['openstack']['block-storage']['ibmnas']['export'] = '/ibm/fs/export'
54
-      end
55
-
56
-      it 'creates IBMNAS shares_config file' do
57
-        expect(chef_run).to create_template(file.name).with(
58
-          owner: 'cinder',
59
-          group: 'cinder',
60
-          mode: '0600'
61
-        )
62
-        expect(chef_run).to render_file(file.name).with_content('127.0.0.1:/ibm/fs/export')
63
-      end
64
-
65
-      it 'upgrades nfs packages' do
66
-        expect(chef_run).to upgrade_package 'nfs-utils'
67
-        expect(chef_run).to upgrade_package 'nfs-utils-lib'
68
-      end
69
-
70
-      it 'creates the nfs mount point' do
71
-        expect(chef_run).to create_directory('/mnt/cinder-volumes').with(
72
-          owner: 'cinder',
73
-          group: 'cinder',
74
-          mode: '0755'
75
-        )
76
-      end
77
-    end
78
-
79
-    context 'NFS Driver' do
80
-      before do
81
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
82
-      end
83
-
84
-      it 'upgrades nfs packages' do
85
-        expect(chef_run).to upgrade_package('nfs-utils')
86
-        expect(chef_run).to upgrade_package('nfs-utils-lib')
87
-      end
88
-    end
89
-
90
-    context 'EMC ISCSI Driver' do
91
-      before do
92
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
93
-      end
94
-
95
-      it 'upgrades emc package' do
96
-        expect(chef_run).to upgrade_package('pywbem')
97
-      end
98
-    end
99
-
100
-    describe 'IBM GPFS volume driver' do
101
-      before do
102
-        @chef_run = ::ChefSpec::SoloRunner.new ::REDHAT_OPTS do |n|
103
-          n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
104
-          n.set['openstack']['block-storage']['gpfs']['gpfs_mount_point_base'] = 'volumes'
105
-          n.set['openstack']['block-storage']['volume']['multi_backend'] =
106
-          {
107
-            'gpfs01' => {
108
-              'gpfs_mount_point_base' => 'gpfs_volume01',
109
-              'volume_driver' => 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
110
-            },
111
-            'gpfs02' => {
112
-              'gpfs_mount_point_base' => 'gpfs_volume02',
113
-              'volume_driver' => 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
114
-            }
115
-          }
116
-        end
117
-
118
-        @conf = '/etc/cinder/cinder.conf'
119
-        @chef_run.converge 'openstack-block-storage::volume'
120
-      end
121
-
122
-      it 'verifies gpfs_mount_point_base' do
123
-        expect(@chef_run).to render_file(@conf).with_content(
124
-          /^gpfs_mount_point_base = volumes$/)
125
-      end
126
-
127
-      it 'verifies gpfs_images_dir and gpfs_images_share_mode is set with default value' do
128
-        @chef_run.node.set['openstack']['block-storage']['gpfs']['gpfs_images_dir'] = 'images'
129
-        expect(@chef_run).to render_file(@conf).with_content(
130
-          /^gpfs_images_dir = images$/)
131
-        expect(@chef_run).to render_file(@conf).with_content(
132
-          /^gpfs_images_share_mode = copy_on_write$/)
133
-      end
134
-
135
-      it 'verifies gpfs_images_dir and gpfs_images_share_mode set correctly' do
136
-        @chef_run.node.set['openstack']['block-storage']['gpfs']['gpfs_images_dir'] = 'images'
137
-        @chef_run.node.set['openstack']['block-storage']['gpfs']['gpfs_images_share_mode'] = 'copy'
138
-        expect(@chef_run).to render_file(@conf).with_content(
139
-          /^gpfs_images_dir = images$/)
140
-        expect(@chef_run).to render_file(@conf).with_content(
141
-          /^gpfs_images_share_mode = copy$/)
142
-      end
143
-
144
-      it 'verifies gpfs_sparse_volumes is default' do
145
-        expect(@chef_run).to render_file(@conf).with_content(
146
-          /^gpfs_sparse_volumes = true$/)
147
-      end
148
-
149
-      it 'verifies gpfs_max_clone_depth is default' do
150
-        expect(@chef_run).to render_file(@conf).with_content(
151
-          /^gpfs_max_clone_depth = 8$/)
152
-      end
153
-
154
-      it 'verifies gpfs_storage_pool is default' do
155
-        expect(@chef_run).to render_file(@conf).with_content(
156
-          /^gpfs_storage_pool = system$/)
157
-      end
158
-
159
-      it 'verifies gpfs volume directory is created with owner and mode set correctly' do
160
-        expect(@chef_run).to create_directory('volumes').with(
161
-          owner: 'cinder',
162
-          group: 'cinder',
163
-          mode: '0755'
164
-        )
165
-      end
166
-
167
-      it 'verifies mount point base is created in multi backend case' do
168
-        expect(@chef_run).to create_directory('gpfs_volume01').with(
169
-          owner: 'cinder',
170
-          group: 'cinder',
171
-          mode: '0755'
172
-        )
173
-        expect(@chef_run).to create_directory('gpfs_volume02').with(
174
-          owner: 'cinder',
175
-          group: 'cinder',
176
-          mode: '0755'
177
-        )
178
-      end
179
-    end
180
-
181
-    describe 'create_vg' do
182
-      let(:file) { chef_run.template('/etc/init.d/cinder-group-active') }
183
-      before do
184
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMVolumeDriver'
185
-        node.set['openstack']['block-storage']['volume']['create_volume_group'] = true
186
-        stub_command('vgs cinder-volumes').and_return(false)
187
-      end
188
-
189
-      describe 'template contents' do
190
-        it 'sources /etc/rc.d/init.d/functions' do
191
-          expect(chef_run).to render_file(file.name).with_content(%r{^\s*. /etc/rc.d/init.d/functions$})
192
-        end
193
-
194
-        it 'calls success and echo' do
195
-          [/^\s*success$/, /^\s*echo$/].each do |cmd|
196
-            expect(chef_run).to render_file(file.name).with_content(cmd)
197
-          end
198
-        end
199
-      end
200
-    end
201 47
   end
202 48
 end

+ 0
- 79
spec/volume-suse_spec.rb View File

@@ -1,79 +0,0 @@
1
-# encoding: UTF-8
2
-#
3
-# Cookbook Name:: openstack-block-storage
4
-
5
-require_relative 'spec_helper'
6
-
7
-describe 'openstack-block-storage::volume' do
8
-  describe 'suse' do
9
-    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
10
-    let(:node) { runner.node }
11
-    let(:chef_run) { runner.converge(described_recipe) }
12
-
13
-    include_context 'block-storage-stubs'
14
-
15
-    it 'upgrades cinder volume package' do
16
-      expect(chef_run).to upgrade_package('openstack-cinder-volume')
17
-    end
18
-
19
-    it 'upgrades qemu img package' do
20
-      expect(chef_run).to upgrade_package('qemu-img')
21
-    end
22
-
23
-    it 'upgrades mysql python package' do
24
-      expect(chef_run).to upgrade_package('python-mysql')
25
-    end
26
-
27
-    it 'upgrades postgresql python packages if explicitly told' do
28
-      node.set['openstack']['db']['block-storage']['service_type'] = 'postgresql'
29
-
30
-      expect(chef_run).to upgrade_package('python-psycopg2')
31
-      expect(chef_run).not_to upgrade_package('python-mysql')
32
-    end
33
-
34
-    it 'upgrades cinder iscsi package' do
35
-      expect(chef_run).to upgrade_package('tgt')
36
-    end
37
-
38
-    it 'starts cinder volume' do
39
-      expect(chef_run).to start_service('openstack-cinder-volume')
40
-    end
41
-
42
-    it 'starts cinder volume on boot' do
43
-      expect(chef_run).to enable_service('openstack-cinder-volume')
44
-    end
45
-
46
-    context 'ISCSI' do
47
-      let(:file) { chef_run.template('/etc/tgt/targets.conf') }
48
-      it 'starts iscsi target on boot' do
49
-        expect(chef_run).to enable_service('tgtd')
50
-      end
51
-
52
-      it 'has suse include' do
53
-        expect(chef_run).to render_file(file.name).with_content('include /var/lib/cinder/volumes/*')
54
-        expect(chef_run).not_to render_file(file.name).with_content('include /etc/tgt/conf.d/*.conf')
55
-      end
56
-    end
57
-
58
-    context 'NFS Driver' do
59
-      before do
60
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
61
-      end
62
-
63
-      it 'installs nfs packages' do
64
-        expect(chef_run).to upgrade_package('nfs-utils')
65
-        expect(chef_run).not_to upgrade_package('nfs-utils-lib')
66
-      end
67
-    end
68
-
69
-    context 'EMC ISCSI Driver' do
70
-      before do
71
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
72
-      end
73
-
74
-      it 'installs emc packages' do
75
-        expect(chef_run).to upgrade_package('python-pywbem')
76
-      end
77
-    end
78
-  end
79
-end

+ 0
- 282
spec/volume_spec.rb View File

@@ -50,168 +50,6 @@ describe 'openstack-block-storage::volume' do
50 50
       expect(chef_run).to upgrade_package 'tgt'
51 51
     end
52 52
 
53
-    it 'upgrades emc package' do
54
-      node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
55
-
56
-      expect(chef_run).to upgrade_package 'python-pywbem'
57
-    end
58
-
59
-    context 'IBMNAS Driver' do
60
-      let(:file) { chef_run.template('/etc/cinder/nfs_shares.conf') }
61
-      before do
62
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver'
63
-      end
64
-
65
-      context 'IBMNAS shares_config file' do
66
-        it 'creates the file' do
67
-          expect(chef_run).to create_template(file.name).with(
68
-            owner: 'cinder',
69
-            group: 'cinder',
70
-            mode: '0600'
71
-          )
72
-        end
73
-
74
-        it 'sets the ibmnas access_ip attribute' do
75
-          node.set['openstack']['block-storage']['ibmnas']['nas_access_ip'] = '127.0.0.1'
76
-          node.set['openstack']['block-storage']['ibmnas']['export'] = '/ibm/fs/export'
77
-          expect(chef_run).to render_file(file.name).with_content('127.0.0.1:/ibm/fs/export')
78
-        end
79
-      end
80
-
81
-      it 'upgrades nfs package' do
82
-        expect(chef_run).to upgrade_package 'nfs-common'
83
-      end
84
-
85
-      it 'creates the nfs mount point' do
86
-        expect(chef_run).to create_directory('/mnt/cinder-volumes').with(
87
-          owner: 'cinder',
88
-          group: 'cinder',
89
-          mode: '0755'
90
-        )
91
-      end
92
-    end
93
-
94
-    context 'NetApp Driver' do
95
-      describe 'NFS' do
96
-        before do
97
-          node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
98
-        end
99
-
100
-        it 'upgrades nfs package' do
101
-          expect(chef_run).to upgrade_package 'nfs-common'
102
-        end
103
-
104
-        it 'creates the nfs mount point' do
105
-          expect(chef_run).to create_directory '/mnt/cinder-volumes'
106
-        end
107
-
108
-        context 'shares config file' do
109
-          let(:shares_config_file) { 'nfs_shares_config_file' }
110
-          let(:file) { chef_run.template(shares_config_file) }
111
-
112
-          before do
113
-            node.set['openstack']['block-storage']['nfs']['shares_config'] = shares_config_file
114
-          end
115
-
116
-          it 'creates the file' do
117
-            node.set['openstack']['block-storage']['user'] = 'test_user'
118
-            node.set['openstack']['block-storage']['group'] = 'test_group'
119
-
120
-            expect(chef_run).to create_template(file.name).with(
121
-              owner: 'test_user',
122
-              group: 'test_group',
123
-              mode: '0600'
124
-            )
125
-          end
126
-
127
-          it 'sets netapp server hostname export settings' do
128
-            netapp_server_hostname = %w(hostname1 hostname2)
129
-            node.set['openstack']['block-storage']['netapp']['netapp_server_hostname'] = netapp_server_hostname
130
-            node.set['openstack']['block-storage']['netapp']['export'] = 'netapp_export_value'
131
-
132
-            netapp_server_hostname.each do |hostname|
133
-              expect(chef_run).to render_file(file.name).with_content(/^#{hostname}:netapp_export_value$/)
134
-            end
135
-          end
136
-        end
137
-      end
138
-
139
-      describe 'ISCSI' do
140
-        before do
141
-          node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver'
142
-        end
143
-
144
-        it 'configures netapp dfm password' do
145
-          n = chef_run.node['openstack']['block-storage']['netapp']['dfm_password']
146
-          expect(n).to eq 'netapp-pass'
147
-        end
148
-      end
149
-    end
150
-
151
-    context 'Ceph (RBD) Driver' do
152
-      let(:file) { chef_run.template('/etc/ceph/ceph.client.cinder.keyring') }
153
-      before do
154
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.rbd.RBDDriver'
155
-        node.set['ceph']['config']['fsid'] = '00000000-0000-0000-0000-000000000000'
156
-      end
157
-
158
-      it 'includes the ceph recipe' do
159
-        expect(chef_run).to include_recipe('ceph')
160
-      end
161
-    end
162
-    context 'Storewize Driver' do
163
-      let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
164
-      before do
165
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.storwize_svc.StorwizeSVCDriver'
166
-      end
167
-
168
-      it 'download san private key if needed' do
169
-        node.set['openstack']['block-storage']['storwize']['san_private_key_url'] = 'http://server/key'
170
-        expect(chef_run).to create_remote_file('/v7000_rsa').with(
171
-          source: 'http://server/key',
172
-          user: 'cinder',
173
-          group: 'cinder',
174
-          mode: '0400'
175
-        )
176
-      end
177
-
178
-      it 'upgrades svc package' do
179
-        expect(chef_run).to upgrade_package 'sysfsutils'
180
-      end
181
-
182
-      context 'ISCSI' do
183
-        before do
184
-          node.set['openstack']['block-storage']['storwize']['storwize_svc_connection_protocol'] = 'iSCSI'
185
-        end
186
-
187
-        it 'configures storewize with iscsi' do
188
-          # Test that the FC specific options are not set when connected via iSCSI
189
-          expect(chef_run).not_to render_file(file.name).with_content('storwize_svc_multipath_enabled')
190
-        end
191
-      end
192
-
193
-      context 'FC' do
194
-        before do
195
-          node.set['openstack']['block-storage']['storwize']['storwize_svc_connection_protocol'] = 'FC'
196
-        end
197
-
198
-        it 'configures storewize with fc' do
199
-          # Test that the iSCSI specific options are not set when connected via FC
200
-          expect(chef_run).not_to render_file(file.name).with_content('storwize_svc_iscsi_chap_enabled')
201
-        end
202
-      end
203
-    end
204
-
205
-    context 'FlashSystem Driver' do
206
-      before do
207
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.flashsystem.FlashSystemDriver'
208
-      end
209
-
210
-      it 'upgrades sysfsutils package' do
211
-        expect(chef_run).to upgrade_package 'sysfsutils'
212
-      end
213
-    end
214
-
215 53
     describe 'targets.conf' do
216 54
       let(:file) { chef_run.template('/etc/tgt/targets.conf') }
217 55
 
@@ -232,125 +70,5 @@ describe 'openstack-block-storage::volume' do
232 70
         expect(chef_run).not_to render_file(file.name).with_content('include volumes_dir_value/*')
233 71
       end
234 72
     end
235
-
236
-    describe 'create_vg' do
237
-      let(:file) { chef_run.template('/etc/init.d/cinder-group-active') }
238
-      before do
239
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMVolumeDriver'
240
-        node.set['openstack']['block-storage']['volume']['create_volume_group'] = true
241
-        stub_command('vgs cinder-volumes').and_return(false)
242
-      end
243
-
244
-      it 'upgrades lvm packages' do
245
-        expect(chef_run).to upgrade_package 'lvm2'
246
-      end
247
-
248
-      it 'cinder vg active' do
249
-        expect(chef_run).to enable_service 'cinder-group-active'
250
-      end
251
-
252
-      it 'create volume group' do
253
-        volume_size = chef_run.node['openstack']['block-storage']['volume']['volume_group_size']
254
-        seek_count = volume_size.to_i * 1024
255
-        group_name = chef_run.node['openstack']['block-storage']['volume']['volume_group']
256
-        path = chef_run.node['openstack']['block-storage']['volume']['state_path']
257
-        vg_file = "#{path}/#{group_name}.img"
258
-        cmd = "dd if=/dev/zero of=#{vg_file} bs=1M seek=#{seek_count} count=0; vgcreate cinder-volumes $(losetup --show -f #{vg_file})"
259
-        expect(chef_run).to run_execute(cmd)
260
-      end
261
-
262
-      it 'notifies cinder group active start' do
263
-        expect(file).to notify('service[cinder-group-active]').to(:start)
264
-      end
265
-
266
-      it 'creates cinder group active template file' do
267
-        expect(chef_run).to create_template(file.name)
268
-      end
269
-
270
-      describe 'template contents' do
271
-        let(:volume_group_value) { 'volume_group_value' }
272
-        before do
273
-          node.set['openstack']['block-storage']['volume']['volume_group'] = volume_group_value
274
-          stub_command("vgs #{volume_group_value}").and_return(true)
275
-        end
276
-
277
-        it 'calls vgs with the volume name attribute' do
278
-          expect(chef_run).to render_file(file.name).with_content(%r{vgs #{volume_group_value} > /dev/null 2>&1})
279
-        end
280
-
281
-        it 'calls vgcreate with the volume name and volume file attributes' do
282
-          node.set['openstack']['block-storage']['volume']['state_path'] = 'state_path_value'
283
-          volume_file = "state_path_value/#{volume_group_value}.img"
284
-          expect(chef_run).to render_file(file.name).with_content(/vgcreate #{volume_group_value} \$\(losetup --show -f #{volume_file}\)/)
285
-        end
286
-
287
-        it 'has ubuntu settings' do
288
-          expect(chef_run).to render_file(file.name).with_content(/^\s*echo "SUCCESS"/)
289
-          expect(chef_run).not_to render_file(file.name).with_content(/^\s*success$/)
290
-        end
291
-      end
292
-    end
293
-
294
-    describe 'create vg on block devices' do
295
-      before do
296
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMVolumeDriver'
297
-        node.set['openstack']['block-storage']['volume']['create_volume_group'] = true
298
-        node.set['openstack']['block-storage']['volume']['create_volume_group_type'] = 'block_devices'
299
-        node.set['openstack']['block-storage']['volume']['block_devices'] = '/dev/sdx /dev/sdx1'
300
-        stub_command('vgs cinder-volumes').and_return(false)
301
-      end
302
-
303
-      it 'create volume group on block devices' do
304
-        cmd = 'pvcreate /dev/sdx /dev/sdx1; vgcreate cinder-volumes /dev/sdx /dev/sdx1'
305
-        expect(chef_run).to run_execute('Create Cinder volume group with block devices').with(command: cmd)
306
-      end
307
-    end
308
-
309
-    describe 'cinder_emc_config.xml' do
310
-      let(:file) { chef_run.template('/etc/cinder/cinder_emc_config.xml') }
311
-      before do
312
-        node.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.emc.emc_smis_iscsi.EMCSMISISCSIDriver'
313
-      end
314
-
315
-      it 'creates cinder emc config file' do
316
-        expect(chef_run).to create_template(file.name).with(
317
-          mode: 0644
318
-        )
319
-      end
320
-
321
-      describe 'template contents' do
322
-        before do
323
-          allow_any_instance_of(Chef::Recipe).to receive(:get_password)
324
-            .with('user', anything)
325
-            .and_return('emc_test_pass')
326
-        end
327
-
328
-        %w(StorageType EcomServerPort EcomUserName).each do |attr|
329
-          it "has an emc #{attr} setting" do
330
-            node.set['openstack']['block-storage']['emc'][attr] = "emc_#{attr}_value"
331
-            expect(chef_run).to render_file(file.name).with_content(%r{^<#{attr}>emc_#{attr}_value</#{attr}>$})
332
-          end
333
-        end
334
-
335
-        it 'has a EcomServerIP' do
336
-          node.set['openstack']['block-storage']['emc']['EcomServerIP'] = 'emc_EcomServerIP_value'
337
-          expect(chef_run).to render_file(file.name).with_content(%r{^<EcomServerIp>emc_EcomServerIP_value</EcomServerIp>$})
338
-        end
339
-
340
-        it 'has EcomPassword' do
341
-          node.set['openstack']['block-storage']['emc']['EcomUserName'] = 'emc_username'
342
-          expect(chef_run).to render_file(file.name).with_content(%r{^<EcomPassword>emc_test_pass</EcomPassword>$})
343
-        end
344
-
345
-        it 'does not have MaskingView when not specified' do
346
-          expect(chef_run).not_to render_file(file.name).with_content(/^<MaskingView>/)
347
-        end
348
-
349
-        it 'has MaskingView when specified' do
350
-          node.set['openstack']['block-storage']['emc']['MaskingView'] = 'testMaskingView'
351
-          expect(chef_run).to render_file(file.name).with_content(%r{^<MaskingView>testMaskingView</MaskingView>$})
352
-        end
353
-      end
354
-    end
355 73
   end
356 74
 end

+ 11
- 1380
templates/default/cinder.conf.erb
File diff suppressed because it is too large
View File


+ 0
- 10
templates/default/cinder_emc_config.xml.erb View File

@@ -1,10 +0,0 @@
1
-<EMC>
2
-<StorageType><%= node["openstack"]["block-storage"]["emc"]["StorageType"] %></StorageType>
3
-<EcomServerIp><%= node["openstack"]["block-storage"]["emc"]["EcomServerIP"] %></EcomServerIp>
4
-<EcomServerPort><%= node["openstack"]["block-storage"]["emc"]["EcomServerPort"] %></EcomServerPort>
5
-<EcomUserName><%= node["openstack"]["block-storage"]["emc"]["EcomUserName"] %></EcomUserName>
6
-<EcomPassword><%= @ecom_password %></EcomPassword>
7
-<% unless node["openstack"]["block-storage"]["emc"]["MaskingView"].nil? %>
8
-<MaskingView><%= node["openstack"]["block-storage"]["emc"]["MaskingView"] %></MaskingView>
9
-<% end %>
10
-</EMC>

+ 0
- 3
templates/default/nfs_shares.conf.erb View File

@@ -1,3 +0,0 @@
1
-<%= node["openstack"]["block-storage"]["custom_template_banner"] %>
2
-
3
-<%= @host %>:<%= @export %>

+ 0
- 29
templates/default/rootwrap.conf.erb View File

@@ -1,29 +0,0 @@
1
-<%= node['openstack']['block-storage']['custom_template_banner'] %>
2
-
3
-# Configuration for cinder-rootwrap
4
-# This file should be owned by (and only-writeable by) the root user
5
-
6
-[DEFAULT]
7
-# List of directories to load filter definitions from (separated by ',').
8
-# These directories MUST all be only writeable by root !
9
-filters_path=/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap
10
-
11
-# List of directories to search executables in, in case filters do not
12
-# explicitely specify a full path (separated by ',')
13
-# If not specified, defaults to system PATH environment variable.
14
-# These directories MUST all be only writeable by root !
15
-exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin
16
-
17
-# Enable logging to syslog
18
-# Default value is False
19
-use_syslog=False
20
-
21
-# Which syslog facility to use.
22
-# Valid values include auth, authpriv, syslog, local0, local1...
23
-# Default value is 'syslog'
24
-syslog_log_facility=syslog
25
-
26
-# Which messages to log.
27
-# INFO means log all usage
28
-# ERROR means only log unsuccessful attempts
29
-syslog_log_level=ERROR

+ 0
- 5
templates/default/shares.conf.erb View File

@@ -1,5 +0,0 @@
1
-<%= node["openstack"]["block-storage"]["custom_template_banner"] %>
2
-
3
-<% node["openstack"]["block-storage"]["netapp"]["netapp_server_hostname"].each do |h| %>
4
-<%= h %>:<%= @export %>
5
-<% end %>

+ 3
- 3
templates/default/targets.conf.erb View File

@@ -1,9 +1,9 @@
1 1
 <%= node["openstack"]["block-storage"]["custom_template_banner"] %>
2 2
 
3
-<% if %w{rhel fedora suse}.include?(node["platform_family"]) %>
4
-include <%= node['openstack']['block-storage']['volume']['volumes_dir'] %>/*
3
+<% if %w(rhel).include?(node["platform_family"]) %>
4
+include <%= node['openstack']['block-storage']['conf']['DEFAULT']['volumes_dir'] %>/*
5 5
 <% end %>
6
-<% if %w{debian}.include?(node["platform_family"]) %>
6
+<% if %w(debian).include?(node["platform_family"]) %>
7 7
 include /etc/tgt/conf.d/*.conf
8 8
 <% end %>
9 9
 default-driver iscsi

Loading…
Cancel
Save