Merge pull request #38 from bodepd/multi_node_work

Multi node work
This commit is contained in:
Dan Bode 2011-06-24 15:36:54 -07:00
commit 71c65b66c0
9 changed files with 50 additions and 47 deletions

View File

@ -12,7 +12,7 @@ class nova::all(
$rabbit_virtual_host = undef,
$rabbit_host = undef,
$libvirt_type = 'qemu',
$libvirt_type = 'kvm',
$flat_network_bridge = 'br100',
$flat_network_bridge_ip = '11.0.0.1',
@ -23,6 +23,8 @@ class nova::all(
$image_service = 'nova.image.glance.GlanceImageService',
$glance_api_servers = 'localhost:9292',
$glance_host = 'localhost',
$glance_port = '9292',
$admin_user = 'novaadmin',
$project_name = 'nova',
@ -31,17 +33,11 @@ class nova::all(
) {
# 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":
@ -49,6 +45,8 @@ class nova::all(
sql_connection => "mysql://${db_user}:${db_password}@${db_host}/${db_name}",
image_service => $image_service,
glance_api_servers => $glance_api_servers,
glance_host => $glance_host,
glance_port => $glance_port,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_userid => $rabbit_userid,
@ -59,9 +57,14 @@ class nova::all(
class { "nova::api": enabled => true }
class { "nova::compute":
api_server => $ipaddress,
libvirt_type => $libvirt_type,
enabled => true,
api_server => $ipaddress,
enabled => true,
}
class { 'nova::compute::libvirt':
libvirt_type => $libvirt_type,
flat_network_bridge => $flat_network_bridge,
flat_network_bridge_ip => $flat_network_bridge_ip,
flat_network_bridge_netmask => $flat_network_bridge_netmask,
}
class { "nova::network::flat":
@ -69,6 +72,7 @@ class nova::all(
flat_network_bridge => $flat_network_bridge,
flat_network_bridge_ip => $flat_network_bridge_ip,
flat_network_bridge_netmask => $flat_network_bridge_netmask,
configure_bridge => false,
}
class { "nova::objectstore": enabled => true }

View File

@ -4,15 +4,12 @@ class nova::compute(
$api_server,
$enabled = false,
$api_port = 8773,
$aws_address = '169.254.169.254',
$libvirt_type = 'kvm'
$aws_address = '169.254.169.254'
) {
Exec['post-nova_config'] ~> Service['nova-compute']
Exec['nova-db-sync'] ~> Service['nova-compute']
nova_config { 'libvirt_type': value => $libvirt_type }
if $enabled {
$service_ensure = 'running'
} else {
@ -25,16 +22,16 @@ class nova::compute(
}
service { "nova-compute":
ensure => $service_ensure,
enable => $enabled,
ensure => $service_ensure,
enable => $enabled,
require => Package["nova-compute"],
before => Exec['networking-refresh'],
}
# forward guest metadata requests to correct API server
exec { "forward_api_requests":
command => "/sbin/iptables -t nat -A PREROUTING -d ${aws_address}/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination ${api_server}:${api_port}",
unless => "/sbin/iptables -L PREROUTING -t nat -n | egrep 'DNAT[ ]+tcp+[ ]+--[ ]+0.0.0.0\\/0+[ ]+${aws_address}+[ ]+tcp+[ ]+dpt:80+[ ]+to:${api_server}:${api_port}'"
}
# exec { "forward_api_requests":
# command => "/sbin/iptables -t nat -A PREROUTING -d ${aws_address}/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination ${api_server}:${api_port}",
# unless => "/sbin/iptables -L PREROUTING -t nat -n | egrep 'DNAT[ ]+tcp+[ ]+--[ ]+0.0.0.0\\/0+[ ]+${aws_address}+[ ]+tcp+[ ]+dpt:80+[ ]+to:${api_server}:${api_port}'",
# logoutput => on_failure
# }
}

View File

@ -0,0 +1,12 @@
class nova::compute::libvirt (
$libvirt_type = 'kvm',
$flat_network_bridge = 'br100',
$flat_network_bridge_ip,
$flat_network_bridge_netmask
) {
nova_config { 'libvirt_type': value => $libvirt_type }
nova::network::bridge { $flat_network_bridge:
ip => $flat_network_bridge_ip,
netmask => $flat_network_bridge_netmask,
}
}

View File

@ -1,29 +1,18 @@
class nova::compute::xenserver(
# TODO - what does this host do?
$host,
$api_server,
$xenapi_connection_url,
$xenapi_connection_username,
$xenapi_connection_password,
$xenapi_inject_image=false,
$network_manager='nova.network.manager.FlatManager',
$flat_network_bridge='xenbr0',
$enabled=true
$xenapi_inject_image=false
) {
class { 'nova::compute':
api_server => $api_server,
enabled => $enabled,
}
nova_config {
'connection_type': value => 'xenapi';
'xenapi_connection_url': value => $xenapi_connection_url;
'xenapi_connection_username': value => $xenapi_connection_username;
'xenapi_connection_password': value => $xenapi_connection_password;
'xenapi_inject_image': value => $xenapi_inject_image;
'network_manager': value => $network_manager;
'flat_network_bridge': value => $flat_network_bridge;
}
package { 'xenapi':
ensure => installed,
provider => pip

View File

@ -49,12 +49,6 @@ class nova::controller(
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,

View File

@ -14,7 +14,8 @@ class nova(
$rabbit_port='5672',
$rabbit_userid='guest',
$rabbit_virtual_host='/',
# Following may need to be broken out to different nova services
$network_manager = 'nova.network.manager.FlatManager',
$flat_network_bridge = 'br100',
$service_down_time = 60,
$logdir = '/var/log/nova',
$state_path = '/var/lib/nova',
@ -98,6 +99,10 @@ class nova(
'state_path': value => $state_path;
'lock_path': value => $lock_path;
'service_down_time': value => $service_down_time;
# These network entries wound up in the common
# config b/c they have to be set by both compute
# as well as controller.
'network_manager': value => $network_manager;
}
exec { 'post-nova_config':
@ -105,6 +110,12 @@ class nova(
refreshonly => true,
}
if $network_manager == 'nova.network.manager.FlatManager' {
nova_config {
'flat_network_bridge': value => $flat_network_bridge
}
}
if $image_service == 'nova.image.glance.GlanceImageService' {
nova_config {
'glance_api_servers': value => $glance_api_servers;

View File

@ -11,11 +11,6 @@ class nova::network::flat (
enabled => $enabled,
}
nova_config {
'network_manager': value => 'nova.network.manager.FlatManager';
'flat_network_bridge': value => $flat_network_bridge;
}
# flatManager requires a network bridge be manually setup.
if $configure_bridge {
nova::network::bridge { $flat_network_bridge:

View File

@ -14,7 +14,6 @@ class nova::network::flatdhcp (
}
nova_config {
'network_manage': value => 'nova.network.manager.FlatDHCPManager';
'public_interface': value => $public_interface;
'flat_interface': value => $flat_interface;
'flat_dhcp_start': value => $flat_dhcp_start;

2
tests/compute/libvirt.pp Normal file
View File

@ -0,0 +1,2 @@
$libvirt_hash = { 'nova::compute::libvirt' => {} }
create_resources( 'class', $libvirt_hash)