Add volume_clear & volume_clear_size options for LVM

- Split out LVM configuration using LVM Driver
- Add volume_clear_size & volume_clear attributes/configuration
- Add tests for these values

Change-Id: I07376e3b3152e986ba1efeb9f1773fba1c4c436d
Closes-Bug: #1279756
This commit is contained in:
Andy McCrae 2014-02-13 11:18:50 +00:00
parent 2b42e6cffe
commit c5e70d1e56
4 changed files with 33 additions and 1 deletions

View File

@ -86,6 +86,8 @@ Cinder attributes
* `openstack["block-storage"]["platform"]` - hash of platform specific package/service names and options
* `openstack["block-storage"]["volume"]["state_path"]` - Top-level directory for maintaining cinder's state
* `openstack["block-storage"]["volume"]["driver"]` - Driver to use for volume creation
* `openstack["block-storage"]["volume"]["volume_clear"]` - Defines the method for clearing volumes on a volume delete possible options: 'zero', 'none', 'shred' (https://review.openstack.org/#/c/12521/)
* `openstack["block-storage"]["volume"]["volume_clear_size"]` - size in MB used to limit the cleared area on deleting a volume, to the first part of the volume only. (default 0 = all MB)
* `openstack["block-storage"]["volume"]["volume_group"]` - Name for the VG that will contain exported volumes
* `openstack["block-storage"]["voluem"]["volume_group_size"]` - The size (GB) of volume group (default is 40)
* `openstack["block-storage"]["voluem"]["create_volume_group"]` - Create volume group or not when using the LVMISCSIDriver (default is false)

View File

@ -140,6 +140,9 @@ default['openstack']['block-storage']['volume']['volumes_dir'] = '/var/lib/cinde
default['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMISCSIDriver'
default['openstack']['block-storage']['volume']['volume_group'] = 'cinder-volumes'
default['openstack']['block-storage']['volume']['volume_group_size'] = 40
default['openstack']['block-storage']['volume']['volume_clear_size'] = 0
default['openstack']['block-storage']['volume']['volume_clear'] = 'zero'
default['openstack']['block-storage']['volume']['create_volume_group'] = false
default['openstack']['block-storage']['volume']['iscsi_helper'] = 'tgtadm'
default['openstack']['block-storage']['volume']['iscsi_ip_address'] = node['ipaddress']

View File

@ -216,6 +216,30 @@ describe 'openstack-block-storage::cinder-common' do
expect(@chef_run).to render_file(@file.name).with_content('notification_driver=cinder.test_driver')
end
end
describe 'lvm settings' do
before do
@chef_run = ::ChefSpec::Runner.new(::UBUNTU_OPTS) do |n|
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.lvm.LVMISCSIDriver'
n.set['openstack']['block-storage']['volume']['volume_group'] = 'test-group'
n.set['openstack']['block-storage']['volume']['volume_clear_size'] = 100
n.set['openstack']['block-storage']['volume']['volume_clear'] = 'none'
end
@chef_run.converge 'openstack-block-storage::cinder-common'
end
it 'has volume_group' do
expect(@chef_run).to render_file(@file.name).with_content('volume_group=test-group')
end
it 'has volume_clear_size' do
expect(@chef_run).to render_file(@file.name).with_content('volume_clear_size=100')
end
it 'has volume_clear' do
expect(@chef_run).to render_file(@file.name).with_content('volume_clear=none')
end
end
end
describe '/var/lock/cinder' do

View File

@ -535,10 +535,13 @@ max_gigabytes=<%= node["openstack"]["block-storage"]["max_gigabytes"] %>
######## defined in cinder.volume.driver ########
<% if node["openstack"]["block-storage"]["volume"]["driver"] == "cinder.volume.drivers.lvm.LVMISCSIDriver" %>
volume_group=<%= node["openstack"]["block-storage"]["volume"]["volume_group"] %>
#### (StrOpt) Name for the VG that will contain exported volumes
volume_clear=<%= node["openstack"]["block-storage"]["volume"]["volume_clear"] %>
volume_clear_size=<%= node["openstack"]["block-storage"]["volume"]["volume_clear_size"] %>
<% end %>
# num_shell_tries=3
#### (IntOpt) number of times to attempt to run flakey shell commands