Merge pull request #33 from bodepd/feature/master/multi-node-db
Feature/master/multi node db
This commit is contained in:
commit
740f59f454
@ -76,7 +76,7 @@ class nova::all(
|
||||
class { 'nova::db':
|
||||
# pass in db config as params
|
||||
password => $db_password,
|
||||
name => $db_name,
|
||||
dbname => $db_name,
|
||||
user => $db_user,
|
||||
host => $db_host,
|
||||
}
|
||||
|
@ -8,9 +8,16 @@ class nova::api($enabled=false) {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
exec { "initial-db-sync":
|
||||
command => "/usr/bin/nova-manage db sync",
|
||||
refreshonly => true,
|
||||
require => [Package["nova-common"], Nova_config['sql_connection']],
|
||||
}
|
||||
|
||||
package { "nova-api":
|
||||
ensure => present,
|
||||
require => Package["python-greenlet"],
|
||||
notify => Exec['initial-db-sync'],
|
||||
}
|
||||
service { "nova-api":
|
||||
ensure => $service_ensure,
|
||||
|
@ -1,8 +1,98 @@
|
||||
class nova::controller () {
|
||||
#
|
||||
# TODO - this is currently hardcoded to be a xenserver
|
||||
class nova::controller(
|
||||
$db_password,
|
||||
$db_name = 'nova',
|
||||
$db_user = 'nova',
|
||||
$db_host = 'localhost',
|
||||
|
||||
class { 'nova::api': }
|
||||
$rabbit_port = undef,
|
||||
$rabbit_userid = undef,
|
||||
$rabbit_password = undef,
|
||||
$rabbit_virtual_host = undef,
|
||||
$rabbit_host = undef,
|
||||
|
||||
class { 'nova::scheduler': }
|
||||
$libvirt_type = 'qemu',
|
||||
|
||||
$flat_network_bridge = 'br100',
|
||||
$flat_network_bridge_ip = '11.0.0.1',
|
||||
$flat_network_bridge_netmask = '255.255.255.0',
|
||||
|
||||
$nova_network = '11.0.0.0',
|
||||
$available_ips = '256',
|
||||
|
||||
$image_service = 'nova.image.glance.GlanceImageService',
|
||||
$glance_host = 'localhost',
|
||||
$glance_port = '9292',
|
||||
|
||||
$admin_user = 'novaadmin',
|
||||
$project_name = 'nova',
|
||||
|
||||
$verbose = undef
|
||||
) {
|
||||
|
||||
|
||||
# work around hostname bug, LP #653405
|
||||
host { $hostname:
|
||||
ip => $ipaddress,
|
||||
host_aliases => $fqdn,
|
||||
}
|
||||
class { 'nova::rabbitmq':
|
||||
port => $rabbit_port,
|
||||
userid => $rabbit_userid,
|
||||
password => $rabbit_password,
|
||||
virtual_host => $rabbit_virtual_host,
|
||||
require => Host[$hostname],
|
||||
}
|
||||
|
||||
class { "nova":
|
||||
verbose => $verbose,
|
||||
sql_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}",
|
||||
image_service => $image_service,
|
||||
glance_host => $glance_host,
|
||||
glance_port => $glance_port,
|
||||
rabbit_host => $rabbit_host,
|
||||
rabbit_port => $rabbit_port,
|
||||
rabbit_userid => $rabbit_userid,
|
||||
rabbit_password => $rabbit_password,
|
||||
rabbit_virtual_host => $rabbit_virtual_host,
|
||||
}
|
||||
|
||||
class { "nova::api": enabled => true }
|
||||
|
||||
class { "nova::compute":
|
||||
api_server => $ipaddress,
|
||||
libvirt_type => $libvirt_type,
|
||||
enabled => true,
|
||||
}
|
||||
|
||||
class { "nova::network::flat":
|
||||
enabled => true,
|
||||
flat_network_bridge => $flat_network_bridge,
|
||||
flat_network_bridge_ip => $flat_network_bridge_ip,
|
||||
flat_network_bridge_netmask => $flat_network_bridge_netmask,
|
||||
}
|
||||
|
||||
class { "nova::objectstore": enabled => true }
|
||||
class { "nova::scheduler": enabled => true }
|
||||
|
||||
nova::manage::admin { $admin_user: }
|
||||
nova::manage::project { $project_name:
|
||||
owner => $admin_user,
|
||||
}
|
||||
|
||||
nova::manage::network { "${project_name}-net-${nova_network}":
|
||||
network => $nova_network,
|
||||
available_ips => $available_ips,
|
||||
require => Nova::Manage::Project[$project_name],
|
||||
}
|
||||
|
||||
# set up glance server
|
||||
class { 'glance::api':
|
||||
swift_store_user => 'foo_user',
|
||||
swift_store_key => 'foo_pass',
|
||||
}
|
||||
|
||||
class { 'glance::registry': }
|
||||
|
||||
class { 'nova::network': }
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
class nova::db(
|
||||
$password,
|
||||
$name = 'nova',
|
||||
$dbname = 'nova',
|
||||
$user = 'nova',
|
||||
$host = '127.0.0.1',
|
||||
$allowed_hosts = undef,
|
||||
@ -8,36 +8,31 @@ class nova::db(
|
||||
) {
|
||||
|
||||
# Create the db instance before nova-common if its installed
|
||||
Mysql::Db[$name] -> Package<| title == "nova-common" |>
|
||||
Mysql::Db[$dbname] -> Package<| title == "nova-common" |>
|
||||
Mysql::Db[$dbname] ~> Exec<| title == 'initial-db-sync' |>
|
||||
|
||||
# now this requires storedconfigs
|
||||
# TODO - worry about the security implications
|
||||
@@nova_config { 'database_url':
|
||||
value => "mysql://${user}:${password}@${host}/${name}",
|
||||
value => "mysql://${user}:${password}@${host}/${dbname}",
|
||||
tag => $zone,
|
||||
}
|
||||
|
||||
exec { "initial-db-sync":
|
||||
command => "/usr/bin/nova-manage db sync",
|
||||
refreshonly => true,
|
||||
require => [Package["nova-common"],Nova_config['sql_connection']]
|
||||
}
|
||||
|
||||
mysql::db { $name:
|
||||
mysql::db { $dbname:
|
||||
user => $user,
|
||||
password => $password,
|
||||
host => $host,
|
||||
charset => 'latin1',
|
||||
# I may want to inject some sql
|
||||
require => Class['mysql::server'],
|
||||
notify => Exec["initial-db-sync"],
|
||||
# notify => Exec["initial-db-sync"],
|
||||
}
|
||||
|
||||
if $allowed_hosts {
|
||||
nova::db::host_access { $allowed_hosts:
|
||||
user => $user,
|
||||
password => $password,
|
||||
database => $name,
|
||||
database => $dbname,
|
||||
}
|
||||
} else {
|
||||
Nova::Db::Host_access<<| tag == $cluster_id |>>
|
||||
|
@ -1,9 +1,11 @@
|
||||
define nova::manage::admin {
|
||||
|
||||
File['/etc/nova/nova.conf'] -> Nova::Manage::Admin[$name]
|
||||
Exec<| title == 'initial-db-sync' |> -> Nova_admin[$name]
|
||||
|
||||
nova_admin{ $name:
|
||||
ensure => present,
|
||||
provider => 'nova_manage',
|
||||
notify => Exec["nova-db-sync"],
|
||||
require => Class["nova::db"],
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
define nova::manage::network ( $network, $available_ips ) {
|
||||
File['/etc/nova/nova.conf']->Nova_network[$name]
|
||||
|
||||
File['/etc/nova/nova.conf'] -> Nova_network[$name]
|
||||
Exec<| title == 'initial-db-sync' |> -> Nova_network[$name]
|
||||
|
||||
nova_network { $name:
|
||||
ensure => present,
|
||||
network => $network,
|
||||
available_ips => $available_ips,
|
||||
provider => 'nova_manage',
|
||||
notify => Exec["nova-db-sync"],
|
||||
require => Class["nova::db"],
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
define nova::manage::project ( $owner ) {
|
||||
|
||||
File['/etc/nova/nova.conf'] -> Nova_project[$name]
|
||||
Exec<| title == 'initial-db-sync' |> -> Nova_project[$name]
|
||||
|
||||
nova_project { $name:
|
||||
ensure => present,
|
||||
provider => 'nova_manage',
|
||||
owner => $owner,
|
||||
notify => Exec["nova-db-sync"],
|
||||
require => [Class["nova::db"], Nova::Manage::Admin[$owner]],
|
||||
require => Nova::Manage::Admin[$owner],
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class nova::rackspace::all(
|
||||
class { 'nova::db':
|
||||
# pass in db config as params
|
||||
password => $db_password,
|
||||
name => $db_name,
|
||||
dbname => $db_name,
|
||||
user => $db_user,
|
||||
host => $db_host,
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class nova::ubuntu::all(
|
||||
class { 'nova::db':
|
||||
# pass in db config as params
|
||||
password => $db_password,
|
||||
name => $db_name,
|
||||
dbname => $db_name,
|
||||
user => $db_user,
|
||||
host => $db_host,
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class nova::ubuntu::cc (
|
||||
class { 'nova::db':
|
||||
# pass in db config as params
|
||||
password => $db_password,
|
||||
name => $db_name,
|
||||
dbname => $db_name,
|
||||
user => $db_user,
|
||||
host => $db_host,
|
||||
allowed_hosts => $db_allowed_hosts,
|
||||
|
@ -6,7 +6,7 @@ class { 'mysql::server':
|
||||
}
|
||||
class { 'nova::db':
|
||||
password => 'password',
|
||||
name => 'nova',
|
||||
dbname => 'nova',
|
||||
user => 'nova',
|
||||
host => 'localhost',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user