refactor db connections for compute

This commit refactors the db connection params
in openstack::compute from a single parameter
that represents the connection string to
individual parameters for each db_name,
db_user, db_password, and db_host.

This patch is intended for two purposes.

1. now that the compute requires two seperate
db connections (cinder and nova), by breaking them
down to these parameters, they can share their db_host
parameter.

2. it simplifies the anount of information users have to
specify to a password. In most cases, the defaults will
be sufficient for all other data.

Change-Id: I01a5a987a6a5b390b0a132b4f9b3261aae9c1f13
This commit is contained in:
Dan Bode
2013-05-24 14:02:53 -07:00
parent 990d850248
commit aed432f502
3 changed files with 24 additions and 11 deletions

View File

@@ -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:

View File

@@ -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,

View File

@@ -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',