Add SolidFire support as a provider for cinder

- Add SolidFire attributes
- Re-organise SAN attributes, to be generic and import from
  SolidFire/storwize
- Add tests for SolidFire attributes/settings

Implements: blueprint solidfire-cinder-provider
Change-Id: Ic91be41ca04426e829a68a66317d34db08e60b6f
This commit is contained in:
Andy McCrae 2014-02-12 14:20:34 +00:00
parent 2b42e6cffe
commit 7dce1f09bc
5 changed files with 78 additions and 16 deletions

View File

@ -88,6 +88,12 @@ default['openstack']['block-storage']['service_tenant_name'] = 'service'
default['openstack']['block-storage']['service_user'] = 'cinder'
default['openstack']['block-storage']['service_role'] = 'admin'
# SAN Support
default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1'
default['openstack']['block-storage']['san']['san_login'] = 'admin'
default['openstack']['block-storage']['san']['san_private_key'] = '/v7000_rsa'
default['openstack']['block-storage']['san']['san_password'] = 'san_password'
# Netapp support
default['openstack']['block-storage']['netapp']['protocol'] = 'http'
default['openstack']['block-storage']['netapp']['dfm_hostname'] = nil
@ -109,9 +115,9 @@ default['openstack']['block-storage']['nfs']['nfs_disk_util'] = 'df'
default['openstack']['block-storage']['nfs']['nfs_sparsed_volumes'] = 'true'
# Storwize/SVC Support
default['openstack']['block-storage']['san']['san_ip'] = '127.0.0.1'
default['openstack']['block-storage']['san']['san_login'] = 'admin'
default['openstack']['block-storage']['san']['san_private_key'] = '/v7000_rsa'
default['openstack']['block-storage']['storwize']['san_ip'] = node['openstack']['block-storage']['san']['san_ip']
default['openstack']['block-storage']['storwize']['san_login'] = node['openstack']['block-storage']['san']['san_login']
default['openstack']['block-storage']['storwize']['san_private_key'] = node['openstack']['block-storage']['san']['san_private_key']
default['openstack']['block-storage']['storwize']['storwize_svc_volpool_name'] = 'volpool'
default['openstack']['block-storage']['storwize']['storwize_svc_vol_rsize'] = '2%'
default['openstack']['block-storage']['storwize']['storwize_svc_vol_warning'] = 0
@ -126,6 +132,13 @@ default['openstack']['block-storage']['storwize']['storwize_svc_iscsi_chap_enabl
default['openstack']['block-storage']['storwize']['storwize_svc_multipath_enabled'] = false
default['openstack']['block-storage']['storwize']['storwize_svc_multihostmap_enabled'] = true
# SolidFire Support
default['openstack']['block-storage']['solidfire']['san_ip'] = node['openstack']['block-storage']['san']['san_ip']
default['openstack']['block-storage']['solidfire']['san_login'] = node['openstack']['block-storage']['san']['san_login']
default['openstack']['block-storage']['solidfire']['san_password'] = node['openstack']['block-storage']['san']['san_password']
default['openstack']['block-storage']['solidfire']['sf_emulate'] = 'False'
default['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = nil
# logging attribute
default['openstack']['block-storage']['syslog']['use'] = false
default['openstack']['block-storage']['syslog']['facility'] = 'LOG_LOCAL2'

View File

@ -41,6 +41,10 @@ if node['openstack']['mq']['block-storage']['service_type'] == 'rabbitmq'
rabbit_pass = get_password 'user', node['openstack']['mq']['block-storage']['rabbit']['userid']
end
if node['openstack']['block-storage']['volume']['driver'] == 'cinder.volume.drivers.solidfire.SolidFire'
solidfire_pass = get_password 'user', node['openstack']['block-storage']['solidfire']['san_login']
end
glance_api_endpoint = endpoint 'image-api'
directory '/etc/cinder' do
@ -60,7 +64,8 @@ template '/etc/cinder/cinder.conf' do
rabbit_password: rabbit_pass,
rabbit_hosts: rabbit_hosts,
glance_host: glance_api_endpoint.host,
glance_port: glance_api_endpoint.port
glance_port: glance_api_endpoint.port,
solidfire_pass: solidfire_pass
)
end

View File

@ -216,6 +216,44 @@ 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 'solidfire settings' do
before do
@chef_run = ::ChefSpec::Runner.new(::UBUNTU_OPTS) do |n|
n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.solidfire.SolidFire'
n.set['openstack']['block-storage']['solidfire']['sf_emulate'] = 'test'
n.set['openstack']['block-storage']['solidfire']['san_ip'] = '203.0.113.10'
n.set['openstack']['block-storage']['solidfire']['san_login'] = 'solidfire_admin'
end
@chef_run.converge 'openstack-block-storage::cinder-common'
end
it 'has solidfire sf_emulate set' do
expect(@chef_run).to render_file(@file.name).with_content('sf_emulate_512=test')
end
it 'has solidfire san_ip set' do
expect(@chef_run).to render_file(@file.name).with_content('san_ip=203.0.113.10')
end
it 'has solidfire san_login' do
expect(@chef_run).to render_file(@file.name).with_content('san_login=solidfire_admin')
end
it 'has solidfire password' do
expect(@chef_run).to render_file(@file.name).with_content('san_password=solidfire_testpass')
end
it 'does not have iscsi_ip_prefix not specified' do
expect(@chef_run).to_not render_file(@file.name).with_content('iscsi_ip_prefix')
end
it 'does have iscsi_ip_prefix when specified' do
@chef_run.node.set['openstack']['block-storage']['solidfire']['iscsi_ip_prefix'] = '203.0.113.*'
expect(@chef_run).to render_file(@file.name).with_content('iscsi_ip_prefix=203.0.113.*')
end
end
end
describe '/var/lock/cinder' do

View File

@ -39,6 +39,9 @@ def block_storage_stubs # rubocop:disable MethodLength
::Chef::Recipe.any_instance.stub(:get_password)
.with('user', 'guest')
.and_return('rabbit-pass')
::Chef::Recipe.any_instance.stub(:get_password)
.with('user', 'solidfire_admin')
.and_return('solidfire_testpass')
::Chef::Recipe.any_instance.stub(:get_password)
.with('service', 'openstack-block-storage')
.and_return('cinder-pass')

View File

@ -281,7 +281,7 @@ snapshot_name_template=<%= node["openstack"]["block-storage"]["snapshot_name_tem
######## defined in cinder.openstack.common.log ########
# logdir=<None>
#### (StrOpt) Log output to a per-service log file in named directory
### (StrOpt) Log output to a per-service log file in named directory
# logfile=<None>
#### (StrOpt) Log output to a named file
@ -696,13 +696,13 @@ nfs_sparsed_volumes=<%= node["openstack"]["block-storage"]["nfs"]["nfs_sparsed_v
<% if node["openstack"]["block-storage"]["volume"]["driver"] == "cinder.volume.drivers.storwize_svc.StorwizeSVCDriver" %>
san_ip=<%= node["openstack"]["block-storage"]["san"]["san_ip"] %>
san_ip=<%= node["openstack"]["block-storage"]["storwize"]["san_ip"] %>
#### (StrOpt) IP address of SAN controller
san_login=<%= node["openstack"]["block-storage"]["san"]["san_login"] %>
san_login=<%= node["openstack"]["block-storage"]["storwize"]["san_login"] %>
#### (StrOpt) Username for SAN controller
san_private_key=<%= node["openstack"]["block-storage"]["san"]["san_private_key"] %>
san_private_key=<%= node["openstack"]["block-storage"]["storwize"]["san_private_key"] %>
#### (StrOpt) Filename of private key to use for SSH authentication
<% else %>
@ -735,23 +735,26 @@ san_private_key=<%= node["openstack"]["block-storage"]["san"]["san_private_key"]
#### (StrOpt) The ZFS path under which to create zvols for volumes.
<% end %>
<% if node["openstack"]["block-storage"]["volume"]["driver"] == "cinder.volume.drivers.solidfire.SolidFire" %>
######## defined in cinder.volume.solidfire ########
# sf_emulate_512=true
sf_emulate_512=<%= node["openstack"]["block-storage"]["solidfire"]["sf_emulate"] %>
#### (BoolOpt) Set 512 byte emulation on volume creation;
# sf_mvip=
#### (StrOpt) IP address of SolidFire MVIP
san_ip=<%= node["openstack"]["block-storage"]["solidfire"]["san_ip"] %>
# #### (StrOpt) IP address of SolidFire MVIP
# sf_login=admin
san_login=<%= node["openstack"]["block-storage"]["solidfire"]["san_login"] %>
#### (StrOpt) Username for SF Cluster Admin
# sf_password=
san_password=<%= @solidfire_pass %>
#### (StrOpt) Password for SF Cluster Admin
# sf_allow_tenant_qos=true
#### (BoolOpt) Allow tenants to specify QOS on create
<% unless node["openstack"]["block-storage"]["solidfire"]['iscsi_ip_prefix'].nil? %>
iscsi_ip_prefix=<%= node["openstack"]["block-storage"]["solidfire"]["iscsi_ip_prefix"] %>
<% end %>
<% end %>
#### (BoolOpt) Allow tenants to specify QOS on create
<% if node["openstack"]["block-storage"]["volume"]["driver"] == "cinder.volume.drivers.storwize_svc.StorwizeSVCDriver" %>
######## defined in cinder.volume.storwize_svc ########