SolidFire backend deployment should use $::os_service_default

Fix SolidFire module to use $::os_service_default and update and
enhance test coverage.

Change-Id: Ide11259e1c55366837ff32ebcc3589e0e8e5a58b
Closes-Bug: #1605368
Closes-Bug: #1605373
(cherry picked from commit 18a914c353)
This commit is contained in:
Ed Balduf 2016-07-22 14:56:15 -06:00
parent 2c26a062dd
commit cada4f5d17
3 changed files with 97 additions and 55 deletions

View File

@ -24,51 +24,51 @@
#
# [*sf_emulate_512*]
# (optional) Use 512 byte emulation for volumes.
# Defaults to True
# Defaults to $::os_service_default
#
# [*sf_allow_tenant_qos*]
# (optional) Allow tenants to specify QoS via volume metadata.
# Defaults to False
# Defaults to $::os_service_default
#
# [*sf_account_prefix*]
# (optional) Prefix to use when creating tenant accounts on SolidFire Cluster.
# Defaults to None, so account name is simply the tenant-uuid
# Defaults to $::os_service_default
#
# [*sf_template_account_name*]
# (optional) Account name on the SolidFire Cluster to use as owner of
# template/cache volumes (created if does not exist)
# Defaults to openstack-vtemplate
# Defaults to $::os_service_default
#
# [*sf_allow_template_caching*]
# (optional) Create an internal cache of copy of images when a bootable
# volume is created to eliminate fetch from glance and qemu-
# conversion on subsequent calls.
# Defaults to false
# Defaults to $::os_service_default
#
# [*sf_api_port*]
# (optional) Port ID to use to connect to SolidFire API.
# Defaults to 443
# Defaults to $::os_service_default
#
# [*sf_volume_prefix*]
# (optional) Create SolidFire volumes with this prefix. Volume names
# are of the form <sf_volume_prefix><cinder-volume-id>.
# Defaults to UUID-
# Defaults to $::os_service_default-
#
# [*sf_svip*]
# (optional) Overrides default cluster SVIP with the one specified.
# This is required or deployments that have implemented the use of
# VLANs for iSCSI networks in their cloud.
# Defaults to none
# Defaults to $::os_service_default
#
# [*sf_enable_volume_mapping*]
# (optional) Create an internal mapping of volume IDs and account.
# Optimizes lookups and performance at the expense of memory, very
# large deployments may want to consider setting to False.
# Defaults to true
# Defaults to $::os_service_default
#
# [*sf_enable_vag*]
# (optional) Utilize volume access groups on a per-tenant basis.
# Defaults to false
# Defaults to $::os_service_default
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
@ -82,16 +82,16 @@ define cinder::backend::solidfire(
$san_password,
$volume_backend_name = $name,
$volume_driver = 'cinder.volume.drivers.solidfire.SolidFireDriver',
$sf_emulate_512 = true,
$sf_allow_tenant_qos = false,
$sf_account_prefix = '',
$sf_template_account_name = 'openstack-vtemplate',
$sf_allow_template_caching = false,
$sf_api_port = '443',
$sf_volume_prefix = 'UUID-',
$sf_svip = '',
$sf_enable_volume_mapping = true,
$sf_enable_vag = false,
$sf_emulate_512 = $::os_service_default,
$sf_allow_tenant_qos = $::os_service_default,
$sf_account_prefix = $::os_service_default,
$sf_template_account_name = $::os_service_default,
$sf_allow_template_caching = $::os_service_default,
$sf_api_port = $::os_service_default,
$sf_volume_prefix = $::os_service_default,
$sf_svip = $::os_service_default,
$sf_enable_volume_mapping = $::os_service_default,
$sf_enable_vag = $::os_service_default,
$extra_options = {},
) {

View File

@ -0,0 +1,9 @@
---
features:
- Switch SolidFire backend parameters to $::os_service_default.
fixes:
- Fixes `bug 1605368
<https://bugs.launchpad.net/puppet-cinder/+bug/1605368>`__
such that the parameter sf_svip is not include when not set.
other:
- Increase code testing coverage for SolidFire backend module.

View File

@ -1,7 +1,9 @@
require 'spec_helper'
describe 'cinder::backend::solidfire' do
let (:title) { 'solidfire' }
let (:config_group_name) { 'solidfire' }
let (:title) { config_group_name }
let :req_params do
{
@ -11,42 +13,39 @@ describe 'cinder::backend::solidfire' do
}
end
let :params do
req_params
let :other_params do
{
:sf_emulate_512 => '<SERVICE DEFAULT>',
:sf_allow_tenant_qos => '<SERVICE DEFAULT>',
:sf_account_prefix => '<SERVICE DEFAULT>',
:sf_template_account_name => '<SERVICE DEFAULT>',
:sf_allow_template_caching => '<SERVICE DEFAULT>',
:sf_api_port => '<SERVICE DEFAULT>',
:sf_volume_prefix => '<SERVICE DEFAULT>',
:sf_svip => '<SERVICE DEFAULT>',
:sf_enable_volume_mapping => '<SERVICE DEFAULT>',
:sf_enable_vag => '<SERVICE DEFAULT>',
}
end
describe 'solidfire volume driver' do
let :facts do
OSDefaults.get_facts({})
end
context 'SolidFire backend driver with minimal params' do
let :params do
req_params
end
it 'configure solidfire volume driver' do
is_expected.to contain_cinder_config('solidfire/volume_driver'
).with_value('cinder.volume.drivers.solidfire.SolidFireDriver')
is_expected.to contain_cinder_config('solidfire/san_ip'
).with_value('127.0.0.2')
is_expected.to contain_cinder_config('solidfire/san_login'
).with_value('solidfire_login')
is_expected.to contain_cinder_config('solidfire/san_password'
).with_value('password')
is_expected.to contain_cinder_config('solidfire/sf_template_account_name'
).with_value('openstack-vtemplate')
is_expected.to contain_cinder_config('solidfire/sf_allow_template_caching'
).with_value(false)
is_expected.to contain_cinder_config('solidfire/volume_backend_name'
).with_value('solidfire')
is_expected.to contain_cinder_config('solidfire/sf_emulate_512'
).with_value(true)
is_expected.to contain_cinder_config('solidfire/sf_allow_tenant_qos'
).with_value(false)
is_expected.to contain_cinder_config('solidfire/sf_account_prefix'
).with_value('')
is_expected.to contain_cinder_config('solidfire/sf_api_port'
).with_value('443')
is_expected.to contain_cinder_config('solidfire/sf_volume_prefix'
).with_value('UUID-')
is_expected.to contain_cinder_config('solidfire/sf_svip'
).with_value('')
is_expected.to contain_cinder_config('solidfire/sf_enable_volume_mapping'
).with_value(true)
is_expected.to contain_cinder_config('solidfire/sf_enable_vag'
).with_value(false)
is_expected.to contain_cinder__backend__solidfire(config_group_name)
is_expected.to contain_cinder_config(
"#{config_group_name}/volume_driver").with_value(
'cinder.volume.drivers.solidfire.SolidFireDriver')
params.each_pair do |config,value|
is_expected.to contain_cinder_config(
"#{config_group_name}/#{config}").with_value(value)
end
end
it 'marks san_password as secret' do
@ -56,7 +55,33 @@ describe 'cinder::backend::solidfire' do
end
describe 'solidfire backend with additional configuration' do
context 'SolidFire backend driver with all params' do
let :params do
req_params.merge(other_params)
end
it 'configure solidfire volume driver' do
is_expected.to contain_cinder__backend__solidfire(config_group_name)
is_expected.to contain_cinder_config(
"#{config_group_name}/volume_driver").with_value(
'cinder.volume.drivers.solidfire.SolidFireDriver')
params.each_pair do |config,value|
is_expected.to contain_cinder_config(
"#{config_group_name}/#{config}").with_value(value)
end
end
it 'marks san_password as secret' do
is_expected.to contain_cinder_config('solidfire/san_password'
).with_secret( true )
end
end
context 'solidfire backend with additional configuration' do
let :params do
req_params
end
before :each do
params.merge!({:extra_options =>
{'solidfire/param1' => {'value' => 'value1'}}})
@ -69,4 +94,12 @@ describe 'cinder::backend::solidfire' do
end
end
context 'without required parameters' do
before do
params = {}
end
it { expect { is_expected.to raise_error(Puppet::PreformattedError) } }
end
end