refactor of cinder manifests

This commit refactors the cinder manifests to make
them more consistent with other manifests:

* removed default value for keystone_password
* removed the prefix cinder_ from class parameters
(it is redundant)
* set package_ensure defaults to present
* removed extra package_ensure parameter
* changed $iscsi_enabled to $volume_driver (this
change is being done in anticipation of needing
additional volume drivers)
* add test coverage
* simple updates to .gitignore
* refactor sql_connection to be composed of multiple class paramters
for consistency.

It also delete the openstack::cinder class b/c
I could not seem to declare ::cinder while it
existed.

Change-Id: I4a7b49d95957675be82c3b77958ae9d0c47eb4fa
This commit is contained in:
Daneyon Hansen
2013-05-14 18:52:49 +00:00
committed by Dan Bode
parent 336292278c
commit b4aa935eac
6 changed files with 192 additions and 87 deletions

View File

@@ -0,0 +1,54 @@
require 'spec_helper'
describe 'openstack::cinder::controller' do
let :required_params do
{
:db_password => 'db_password',
:rabbit_password => 'rabpass',
:keystone_password => 'user_pass'
}
end
let :facts do
{ :osfamily => 'Redhat' }
end
let :params do
required_params
end
it 'should configure using the default values' do
should contain_class('cinder').with(
:sql_connection => "mysql://cinder:#{required_params[:db_password]}@127.0.0.1/cinder?charset=utf8",
:rpc_backend => 'cinder.openstack.common.rpc.impl_kombu',
:rabbit_userid => 'guest',
:rabbit_password => required_params[:rabbit_password],
:rabbit_host => '127.0.0.1',
:rabbit_port => '5672',
:rabbit_hosts => nil,
:rabbit_virtual_host => '/',
:package_ensure => 'present',
:api_paste_config => '/etc/cinder/api-paste.ini',
:verbose => false
)
should contain_class('cinder::api').with(
:keystone_password => required_params[:keystone_password],
:keystone_enabled => true,
:keystone_user => 'cinder',
:keystone_auth_host => 'localhost',
:keystone_auth_port => '35357',
:keystone_auth_protocol => 'http',
:service_port => '5000',
:package_ensure => 'present',
:bind_host => '0.0.0.0',
:enabled => true
)
should contain_class('cinder::scheduler').with(
:scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler',
:package_ensure => 'present',
:enabled => true
)
end
end

View File

@@ -0,0 +1,63 @@
require 'spec_helper'
describe 'openstack::cinder::storage' do
let :required_params do
{
:sql_connection => 'mysql://a:b:c:d',
:rabbit_password => 'rabpass'
}
end
let :params do
required_params
end
let :facts do
{ :osfamily => 'Redhat' }
end
it 'should configure cinder and cinder::volume using defaults and required parameters' do
should contain_class('cinder').with(
:sql_connection => required_params[:sql_connection],
:rabbit_userid => 'guest',
:rabbit_password => required_params[:rabbit_password],
:rabbit_host => '127.0.0.1',
:rabbit_port => '5672',
:rabbit_hosts => nil,
:rabbit_virtual_host => '/',
:package_ensure => 'present',
:api_paste_config => '/etc/cinder/api-paste.ini',
:verbose => false
)
should contain_class('cinder::volume').with(
:package_ensure => 'present',
:enabled => true
)
should contain_class('cinder::volume::iscsi').with(
:iscsi_ip_address => '127.0.0.1',
:volume_group => 'cinder-volumes'
)
should_not contain_class('cinder::setup_test_volume')
end
describe 'with a volume driver other than iscsi' do
let :params do
required_params.merge(
:volume_driver => 'netapp'
)
end
it { should_not contain_class('cinder::volume::iscsi') }
end
describe 'when setting up test volumes for iscsi' do
let :params do
required_params.merge(
:setup_test_volume => 'setup_test_volume'
)
end
it { should contain_class('cinder::setup_test_volume') }
end
end