update cinder config in controller/compute

update the cinder configuration in the controller
and compute classes to use the
new openstack::cinder::controller class.

unset cinder password defaults.

Change-Id: I85e188e787a3495b7c3657a57707d0d08669293c
This commit is contained in:
Dan Bode
2013-05-14 21:13:49 -07:00
parent 6f969efa2e
commit 76c3059336
7 changed files with 95 additions and 81 deletions

View File

@@ -548,6 +548,14 @@ The process for contributing code is as follows:
* Please visit http://wiki.openstack.org/GerritWorkflow and follow the instructions there to upload your change to Gerrit. * Please visit http://wiki.openstack.org/GerritWorkflow and follow the instructions there to upload your change to Gerrit.
* Please add rspec tests for your code if applicable * Please add rspec tests for your code if applicable
## Upgrade warning
The current version of the code is intended for the 2.0 release of the openstack modules and
has the following know backwards incompatible breaking changes from 1.x.
* the cinder parameter has been removed (b/c support for nova-volumes has been removed).
The manage_volumes parameter indicates is cinder volumes should be managed.
## Future features: ## Future features:
efforts are underway to implement the following additional features: efforts are underway to implement the following additional features:

View File

@@ -1,6 +1,7 @@
class openstack::cinder::controller( class openstack::cinder::controller(
$rabbit_password, $rabbit_password,
$keystone_password, $keystone_password,
$db_password,
$rpc_backend = 'cinder.openstack.common.rpc.impl_kombu', $rpc_backend = 'cinder.openstack.common.rpc.impl_kombu',
$keystone_tenant = 'services', $keystone_tenant = 'services',
$keystone_enabled = true, $keystone_enabled = true,
@@ -17,7 +18,6 @@ class openstack::cinder::controller(
# Database. Currently mysql is the only option. # Database. Currently mysql is the only option.
$db_type = 'mysql', $db_type = 'mysql',
$db_user = 'cinder', $db_user = 'cinder',
$db_password = 'cinder_pass',
$db_host = '127.0.0.1', $db_host = '127.0.0.1',
$db_dbname = 'cinder', $db_dbname = 'cinder',
$package_ensure = present, $package_ensure = present,
@@ -34,7 +34,9 @@ class openstack::cinder::controller(
####### DATABASE SETUP ###### ####### DATABASE SETUP ######
# set up mysql server # set up mysql server
if ($db_type == 'mysql') { if ($db_type == 'mysql') {
$sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_dbname}?charset=utf8" $sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_dbname}?charset=utf8"
} else {
fail("Unsupported db_type ${db_type}")
} }
class {'::cinder': class {'::cinder':

View File

@@ -54,14 +54,14 @@ class openstack::compute (
$vncproxy_host = undef, $vncproxy_host = undef,
$vncserver_listen = false, $vncserver_listen = false,
# cinder / volumes # cinder / volumes
$cinder = true,
$cinder_sql_connection = undef,
$manage_volumes = true, $manage_volumes = true,
$cinder_sql_connection = false,
$volume_group = 'cinder-volumes', $volume_group = 'cinder-volumes',
$iscsi_ip_address = '127.0.0.1', $iscsi_ip_address = '127.0.0.1',
$setup_test_volume = false,
# General # General
$migration_support = false, $migration_support = false,
$verbose = 'False', $verbose = false,
$enabled = true $enabled = true
) { ) {
@@ -199,25 +199,30 @@ class openstack::compute (
} }
} }
if ($cinder) { if $manage_volumes {
class { 'cinder::base':
rabbit_password => $rabbit_password, if ! $cinder_sql_connection {
rabbit_host => $rabbit_host, fail('cinder sql connection must be set when cinder is being configured by openstack::compute')
sql_connection => $cinder_sql_connection,
verbose => $verbose,
} }
class { 'cinder::volume': }
class { 'cinder::volume::iscsi': class { 'openstack::cinder::storage':
iscsi_ip_address => $iscsi_ip_address, sql_connection => $cinder_sql_connection,
volume_group => $volume_group, rabbit_password => $rabbit_password,
rabbit_userid => $rabbit_user,
rabbit_host => $rabbit_host,
rabbit_virtual_host => $rabbit_virtual_host,
volume_group => $volume_group,
iscsi_ip_address => $iscsi_ip_address,
enabled => $enabled,
verbose => $verbose,
setup_test_volume => $setup_test_volume,
volume_driver => 'iscsi',
} }
# set in nova::api # set in nova::api
if ! defined(Nova_config['DEFAULT/volume_api_class']) { if ! defined(Nova_config['DEFAULT/volume_api_class']) {
nova_config { 'DEFAULT/volume_api_class': value => 'nova.volume.cinder.API' } nova_config { 'DEFAULT/volume_api_class': value => 'nova.volume.cinder.API' }
} }
} else {
# Set up nova-volume
} }
} }

View File

@@ -82,10 +82,10 @@ class openstack::controller (
$secret_key, $secret_key,
# cinder and quantum password are not required b/c they are # cinder and quantum password are not required b/c they are
# optional. Not sure what to do about this. # optional. Not sure what to do about this.
$cinder_user_password = 'cinder_pass',
$cinder_db_password = 'cinder_pass',
$quantum_user_password = 'quantum_pass', $quantum_user_password = 'quantum_pass',
$quantum_db_password = 'quantum_pass', $quantum_db_password = 'quantum_pass',
$cinder_user_password = false,
$cinder_db_password = false,
# Database # Database
$db_host = '127.0.0.1', $db_host = '127.0.0.1',
$db_type = 'mysql', $db_type = 'mysql',
@@ -306,24 +306,32 @@ class openstack::controller (
######### Cinder Controller Services ######## ######### Cinder Controller Services ########
if ($cinder) { if ($cinder) {
class { "cinder::base":
verbose => $verbose, if ! $cinder_db_password {
sql_connection => "mysql://${cinder_db_user}:${cinder_db_password}@${db_host}/${cinder_db_dbname}?charset=utf8", fail('Must set cinder db password when setting up a cinder controller')
rabbit_password => $rabbit_password,
rabbit_userid => $rabbit_user,
} }
class { 'cinder::api': if ! $cinder_user_password {
keystone_password => $cinder_user_password, fail('Must set cinder user password when setting up a cinder controller')
} }
class { 'cinder::scheduler': } class { 'openstack::cinder::controller':
} else { bind_host => $bind_host,
# Set up nova-volume keystone_auth_host => $keystone_host,
class{ 'nova::volume': } keystone_password => $cinder_user_password,
rabbit_password => $rabbit_password,
rabbit_host => $rabbit_host,
db_password => $cinder_db_password,
db_dbname => $cinder_db_dbname,
db_user => $cinder_db_user,
db_type => $db_type,
db_host => $db_host,
api_enabled => $enabled,
scheduler_enabled => $enabled,
verbose => $verbose
}
} }
######## Horizon ######## ######## Horizon ########
if ($horizon) { if ($horizon) {
class { 'openstack::horizon': class { 'openstack::horizon':

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'openstack::cinder::controller' do describe 'openstack::cinder::controller' do
let :required_params do let :params do
{ {
:db_password => 'db_password', :db_password => 'db_password',
:rabbit_password => 'rabpass', :rabbit_password => 'rabpass',
@@ -14,16 +14,12 @@ describe 'openstack::cinder::controller' do
{ :osfamily => 'Redhat' } { :osfamily => 'Redhat' }
end end
let :params do
required_params
end
it 'should configure using the default values' do it 'should configure using the default values' do
should contain_class('cinder').with( should contain_class('cinder').with(
:sql_connection => "mysql://cinder:#{required_params[:db_password]}@127.0.0.1/cinder?charset=utf8", :sql_connection => "mysql://cinder:#{params[:db_password]}@127.0.0.1/cinder?charset=utf8",
:rpc_backend => 'cinder.openstack.common.rpc.impl_kombu', :rpc_backend => 'cinder.openstack.common.rpc.impl_kombu',
:rabbit_userid => 'guest', :rabbit_userid => 'guest',
:rabbit_password => required_params[:rabbit_password], :rabbit_password => params[:rabbit_password],
:rabbit_host => '127.0.0.1', :rabbit_host => '127.0.0.1',
:rabbit_port => '5672', :rabbit_port => '5672',
:rabbit_hosts => nil, :rabbit_hosts => nil,
@@ -33,7 +29,7 @@ describe 'openstack::cinder::controller' do
:verbose => false :verbose => false
) )
should contain_class('cinder::api').with( should contain_class('cinder::api').with(
:keystone_password => required_params[:keystone_password], :keystone_password => params[:keystone_password],
:keystone_enabled => true, :keystone_enabled => true,
:keystone_user => 'cinder', :keystone_user => 'cinder',
:keystone_auth_host => 'localhost', :keystone_auth_host => 'localhost',
@@ -51,4 +47,15 @@ describe 'openstack::cinder::controller' do
) )
end end
context 'with unsupported db type' do
before do
params.merge!({:db_type => 'sqlite'})
end
it do
expect { subject }.to raise_error(Puppet::Error, /Unsupported db_type sqlite/)
end
end
end end

View File

@@ -5,7 +5,7 @@ describe 'openstack::compute' do
let :params do let :params do
{ {
:private_interface => 'eth0', :private_interface => 'eth0',
:internal_address => '0.0.0.0', :internal_address => '127.0.0.2',
:nova_user_password => 'nova_pass', :nova_user_password => 'nova_pass',
:rabbit_password => 'rabbit_pw', :rabbit_password => 'rabbit_pw',
:rabbit_host => '127.0.0.1', :rabbit_host => '127.0.0.1',
@@ -37,17 +37,17 @@ describe 'openstack::compute' do
:rabbit_virtual_host => '/', :rabbit_virtual_host => '/',
:image_service => 'nova.image.glance.GlanceImageService', :image_service => 'nova.image.glance.GlanceImageService',
:glance_api_servers => false, :glance_api_servers => false,
:verbose => 'False' :verbose => false
) )
should contain_class('nova::compute').with( should contain_class('nova::compute').with(
:enabled => true, :enabled => true,
:vnc_enabled => true, :vnc_enabled => true,
:vncserver_proxyclient_address => '0.0.0.0', :vncserver_proxyclient_address => '127.0.0.2',
:vncproxy_host => false :vncproxy_host => false
) )
should contain_class('nova::compute::libvirt').with( should contain_class('nova::compute::libvirt').with(
:libvirt_type => 'kvm', :libvirt_type => 'kvm',
:vncserver_listen => '0.0.0.0' :vncserver_listen => '127.0.0.2'
) )
should contain_nova_config('DEFAULT/multi_host').with( :value => 'False' ) should contain_nova_config('DEFAULT/multi_host').with( :value => 'False' )
should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => 'False' ) should contain_nova_config('DEFAULT/send_arp_for_ha').with( :value => 'False' )
@@ -65,6 +65,19 @@ describe 'openstack::compute' do
:enabled => false, :enabled => false,
:install_service => false :install_service => false
}) })
should contain_class('openstack::cinder::storage').with(
:sql_connection => 'mysql://user:pass@host/dbcinder',
:rabbit_password => 'rabbit_pw',
:rabbit_userid => 'nova',
:rabbit_host => '127.0.0.1',
:rabbit_virtual_host => '/',
:volume_group => 'cinder-volumes',
:iscsi_ip_address => '127.0.0.1',
:enabled => true,
:verbose => false,
:setup_test_volume => false,
:volume_driver => 'iscsi'
)
} }
end end
@@ -123,44 +136,14 @@ describe 'openstack::compute' do
end end
end end
describe "when enabling volume management" do
before do
params.merge!( :manage_volumes => true )
end
it do
should contain_nova_config('DEFAULT/multi_host').with({ 'value' => 'False'})
should_not contain_class('nova::api')
should contain_class('nova::network').with({
'enabled' => false,
'install_service' => false
})
end
end
context 'with cinder' do context 'with cinder' do
before do before do
params.merge!( params.merge!(
:cinder => true :manage_volumes => false
) )
end end
it { should_not contain_class('openstack::cinder::storage') }
it 'configures cinder' do
should contain_class('cinder::base').with(
:rabbit_password => 'rabbit_pw',
:rabbit_host => '127.0.0.1',
:sql_connection => 'mysql://user:pass@host/dbcinder',
:verbose => 'False'
)
should contain_class('cinder::volume')
should contain_class('cinder::volume::iscsi').with(
:iscsi_ip_address => '127.0.0.1',
:volume_group => 'cinder-volumes'
)
should contain_nova_config('DEFAULT/volume_api_class').with(
:value => 'nova.volume.cinder.API'
)
end
end end
describe 'when quantum is false' do describe 'when quantum is false' do
@@ -266,8 +249,8 @@ describe 'openstack::compute' do
it 'should configure quantum' do it 'should configure quantum' do
should contain_class('quantum').with( should contain_class('quantum').with(
:verbose => 'False', :verbose => false,
:debug => 'False', :debug => false,
:rabbit_host => params[:rabbit_host], :rabbit_host => params[:rabbit_host],
:rabbit_password => params[:rabbit_password] :rabbit_password => params[:rabbit_password]
) )

View File

@@ -19,6 +19,8 @@ describe 'openstack::controller' do
:glance_user_password => 'glance_pass', :glance_user_password => 'glance_pass',
:nova_db_password => 'nova_pass', :nova_db_password => 'nova_pass',
:nova_user_password => 'nova_pass', :nova_user_password => 'nova_pass',
:cinder_db_password => 'cinder_pass',
:cinder_user_password => 'cinder_pass',
:secret_key => 'secret_key', :secret_key => 'secret_key',
:quantum => false, :quantum => false,
:vncproxy_host => '10.0.0.1', :vncproxy_host => '10.0.0.1',
@@ -123,7 +125,6 @@ describe 'openstack::controller' do
) )
end end
it do it do
should contain_class('nova::volume')
should_not contain_class('quantum::db::mysql') should_not contain_class('quantum::db::mysql')
should_not contain_class('cinder::db::mysql') should_not contain_class('cinder::db::mysql')
end end
@@ -424,7 +425,7 @@ describe 'openstack::controller' do
default_params.merge(:cinder => false) default_params.merge(:cinder => false)
end end
it 'should not contain cinder classes' do it 'should not contain cinder classes' do
should_not contain_class('cinder::base') should_not contain_class('cinder')
should_not contain_class('cinder::api') should_not contain_class('cinder::api')
should_not contain_class('cinder:"scheduler') should_not contain_class('cinder:"scheduler')
end end
@@ -435,7 +436,7 @@ describe 'openstack::controller' do
default_params default_params
end end
it 'should configure cinder using defaults' do it 'should configure cinder using defaults' do
should contain_class('cinder::base').with( should contain_class('cinder').with(
:verbose => 'False', :verbose => 'False',
:sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder?charset=utf8', :sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder?charset=utf8',
:rabbit_password => 'rabbit_pw' :rabbit_password => 'rabbit_pw'
@@ -458,7 +459,7 @@ describe 'openstack::controller' do
) )
end end
it 'should configure cinder using defaults' do it 'should configure cinder using defaults' do
should contain_class('cinder::base').with( should contain_class('cinder').with(
:verbose => 'True', :verbose => 'True',
:sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8', :sql_connection => 'mysql://baz:bar@127.0.0.2/blah?charset=utf8',
:rabbit_password => 'rabbit_pw2' :rabbit_password => 'rabbit_pw2'