diff --git a/README.md b/README.md index 26c1edc..9b2c7c0 100644 --- a/README.md +++ b/README.md @@ -555,6 +555,8 @@ 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. +* the names of the sql connection parameters of the openstack::compute class have changed + from sql_connetion to individual parameters for the db user,name,password,host. ## Future features: diff --git a/manifests/compute.pp b/manifests/compute.pp index 8923b6e..9ab4401 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -23,7 +23,11 @@ class openstack::compute ( # Required Rabbit $rabbit_password, # DB - $sql_connection, + $nova_db_password, + $db_host = '127.0.0.1', + # Nova Database + $nova_db_user = 'nova', + $nova_db_name = 'nova', # Network $public_interface = undef, $private_interface = undef, @@ -63,7 +67,9 @@ class openstack::compute ( $vncserver_listen = false, # cinder / volumes $manage_volumes = true, - $cinder_sql_connection = false, + $cinder_db_password = false, + $cinder_db_user = 'cinder', + $cinder_db_name = 'cinder', $volume_group = 'cinder-volumes', $iscsi_ip_address = '127.0.0.1', $setup_test_volume = false, @@ -98,8 +104,10 @@ class openstack::compute ( } } + $nova_sql_connection = "mysql://${nova_db_user}:${nova_db_password}@${db_host}/${nova_db_name}" + class { 'nova': - sql_connection => $sql_connection, + sql_connection => $nova_sql_connection, rabbit_userid => $rabbit_user, rabbit_password => $rabbit_password, image_service => 'nova.image.glance.GlanceImageService', @@ -220,10 +228,12 @@ class openstack::compute ( if $manage_volumes { - if ! $cinder_sql_connection { - fail('cinder sql connection must be set when cinder is being configured by openstack::compute') + if ! $cinder_db_password { + fail('cinder_db_password must be set when cinder is being configured') } + $cinder_sql_connection = "mysql://${cinder_db_user}:${cinder_db_password}@${db_host}/${cinder_db_name}" + class { 'openstack::cinder::storage': sql_connection => $cinder_sql_connection, rabbit_password => $rabbit_password, diff --git a/spec/classes/openstack_compute_spec.rb b/spec/classes/openstack_compute_spec.rb index 046404f..fb2ef6b 100644 --- a/spec/classes/openstack_compute_spec.rb +++ b/spec/classes/openstack_compute_spec.rb @@ -13,8 +13,8 @@ describe 'openstack::compute' do :nova_admin_tenant_name => 'services', :nova_admin_user => 'nova', :enabled_apis => 'ec2,osapi_compute,metadata', - :sql_connection => 'mysql://user:pass@host/dbname', - :cinder_sql_connection => 'mysql://user:pass@host/dbcinder', + :nova_db_password => 'pass', + :cinder_db_password => 'cinder_pass', :quantum => false, :fixed_range => '10.0.0.0/16' } @@ -30,7 +30,7 @@ describe 'openstack::compute' do describe "when using default class parameters" do it { should contain_class('nova').with( - :sql_connection => 'mysql://user:pass@host/dbname', + :sql_connection => 'mysql://nova:pass@127.0.0.1/nova', :rabbit_host => '127.0.0.1', :rabbit_userid => 'openstack', :rabbit_password => 'rabbit_pw', @@ -67,7 +67,7 @@ describe 'openstack::compute' do :install_service => false }) should contain_class('openstack::cinder::storage').with( - :sql_connection => 'mysql://user:pass@host/dbcinder', + :sql_connection => 'mysql://cinder:cinder_pass@127.0.0.1/cinder', :rabbit_password => 'rabbit_pw', :rabbit_userid => 'openstack', :rabbit_host => '127.0.0.1', @@ -88,8 +88,9 @@ describe 'openstack::compute' do :private_interface => 'eth1', :internal_address => '127.0.0.1', :public_interface => 'eth2', - :sql_connection => 'mysql://user:passwd@host/name', :nova_user_password => 'nova_pass', + :nova_db_user => 'nova_user', + :nova_db_name => 'novadb', :rabbit_host => 'my_host', :rabbit_password => 'my_rabbit_pw', :rabbit_user => 'my_rabbit_user', @@ -103,7 +104,7 @@ describe 'openstack::compute' do end it do should contain_class('nova').with( - :sql_connection => 'mysql://user:passwd@host/name', + :sql_connection => 'mysql://nova_user:pass@127.0.0.1/novadb', :rabbit_host => 'my_host', :rabbit_userid => 'my_rabbit_user', :rabbit_password => 'my_rabbit_pw',