Merge pull request #42 from bodepd/network_refactor
Refactor network code
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
class openstack::all(
|
||||
# passing in the public ipaddress is required
|
||||
$public_address,
|
||||
$public_interface,
|
||||
$private_interface,
|
||||
$floating_range = false,
|
||||
$fixed_range = '10.0.0.0/16',
|
||||
$network_manager = 'nova.network.manager.FlatDHCPManager',
|
||||
$network_config = {},
|
||||
# middleware credentials
|
||||
$mysql_root_password = 'sql_pass',
|
||||
$rabbit_password = 'rabbit_pw',
|
||||
@@ -138,7 +144,6 @@ class openstack::all(
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => '127.0.0.1:9292',
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
}
|
||||
|
||||
class { 'nova::api':
|
||||
@@ -146,35 +151,27 @@ class openstack::all(
|
||||
admin_password => $nova_user_password,
|
||||
}
|
||||
|
||||
class { 'nova::scheduler':
|
||||
enabled => true
|
||||
}
|
||||
|
||||
# set up networking
|
||||
class { 'nova::network':
|
||||
enabled => true
|
||||
private_interface => $private_interface,
|
||||
public_interface => $public_interface,
|
||||
fixed_range => $fixed_range,
|
||||
floating_range => $floating_range,
|
||||
install_service => true,
|
||||
enabled => true,
|
||||
network_manager => $network_manager,
|
||||
config_overrides => $network_config,
|
||||
create_networks => true,
|
||||
}
|
||||
|
||||
nova::manage::network { "nova-vm-net":
|
||||
network => '11.0.0.0/24',
|
||||
}
|
||||
|
||||
nova::manage::floating { "nova-vm-floating":
|
||||
network => '10.128.0.0/24',
|
||||
}
|
||||
|
||||
class { 'nova::objectstore':
|
||||
enabled => true
|
||||
}
|
||||
|
||||
class { 'nova::volume':
|
||||
enabled => true
|
||||
}
|
||||
|
||||
class { 'nova::cert':
|
||||
enabled => true
|
||||
}
|
||||
|
||||
class { 'nova::consoleauth':
|
||||
# a bunch of nova services that require no configuration
|
||||
class { [
|
||||
'nova::scheduler',
|
||||
'nova::objectstore',
|
||||
'nova::volume',
|
||||
'nova::cert',
|
||||
'nova::consoleauth'
|
||||
]:
|
||||
enabled => true
|
||||
}
|
||||
|
||||
@@ -195,10 +192,10 @@ class openstack::all(
|
||||
vncserver_listen => '127.0.0.1',
|
||||
}
|
||||
|
||||
nova::network::bridge { 'br100':
|
||||
ip => '11.0.0.1',
|
||||
netmask => '255.255.255.0',
|
||||
}
|
||||
# nova::network::bridge { 'br100':
|
||||
# ip => '11.0.0.1',
|
||||
# netmask => '255.255.255.0',
|
||||
# }
|
||||
|
||||
######## Horizon ########
|
||||
|
||||
|
@@ -10,21 +10,27 @@
|
||||
# TODO - I need to make the choise of networking configurable
|
||||
#
|
||||
class openstack::compute(
|
||||
# my address
|
||||
$private_interface,
|
||||
$internal_address,
|
||||
# networking config
|
||||
$public_interface = undef,
|
||||
$fixed_range = '10.0.0.0/16',
|
||||
$network_manager = 'nova.network.manager.FlatDHCPManager',
|
||||
$multi_host = false,
|
||||
$network_host = false,
|
||||
$network_config = {},
|
||||
# my address
|
||||
# conection information
|
||||
$sql_connection = false,
|
||||
$rabbit_host = false,
|
||||
$rabbit_password = 'rabbit_pw',
|
||||
$rabbit_user = 'nova',
|
||||
$glance_api_servers = false,
|
||||
$vncproxy_host = false,
|
||||
$sql_connection = false,
|
||||
$rabbit_host = false,
|
||||
$rabbit_password = 'rabbit_pw',
|
||||
$rabbit_user = 'nova',
|
||||
$glance_api_servers = false,
|
||||
# nova compute configuration parameters
|
||||
$libvirt_type = 'kvm',
|
||||
$vnc_enabled = 'true',
|
||||
$bridge_ip = '11.0.0.1',
|
||||
$bridge_netmask = '255.255.255.0',
|
||||
$libvirt_type = 'kvm',
|
||||
$vncproxy_host = false,
|
||||
$vnc_enabled = 'true',
|
||||
$verbose = false
|
||||
) {
|
||||
|
||||
class { 'nova':
|
||||
@@ -34,7 +40,6 @@ class openstack::compute(
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => $glance_api_servers,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
verbose => $verbose,
|
||||
}
|
||||
|
||||
@@ -50,9 +55,45 @@ class openstack::compute(
|
||||
vncserver_listen => $internal_address,
|
||||
}
|
||||
|
||||
nova::network::bridge { 'br100':
|
||||
ip => $bridge_ip,
|
||||
netmask => $bridge_netmask,
|
||||
# if the compute node should be configured as a multi-host
|
||||
# compute installation
|
||||
if $multi_host {
|
||||
|
||||
include keystone::python
|
||||
|
||||
nova_config { 'multi_host': value => 'True'; }
|
||||
if ! $public_interface {
|
||||
fail('public_interface must be defined for multi host compute nodes')
|
||||
}
|
||||
$enable_network_service = true
|
||||
class { 'nova::api':
|
||||
enabled => true,
|
||||
admin_tenant_name => 'services',
|
||||
admin_user => 'nova',
|
||||
admin_password => $nova_service_password,
|
||||
}
|
||||
} else {
|
||||
$enable_network_service = false
|
||||
if ! $network_host {
|
||||
fail('network_host must be defined for non multi host compute nodes')
|
||||
}
|
||||
nova_config {
|
||||
'multi_host': value => 'False';
|
||||
'network_host': value => $network_host;
|
||||
}
|
||||
}
|
||||
|
||||
# set up configuration for networking
|
||||
class { 'nova::network':
|
||||
private_interface => $private_interface,
|
||||
public_interface => $public_interface,
|
||||
fixed_range => $fixed_range,
|
||||
floating_range => false,
|
||||
network_manager => $network_manager,
|
||||
config_overrides => $network_config,
|
||||
create_networks => false,
|
||||
enabled => $enable_network_service,
|
||||
install_service => $enable_network_service,
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@
|
||||
class openstack::controller(
|
||||
# my address
|
||||
$public_address,
|
||||
$public_interface,
|
||||
$private_interface,
|
||||
$internal_address,
|
||||
$admin_address = $internal_address,
|
||||
# connection information
|
||||
@@ -25,9 +27,17 @@ class openstack::controller(
|
||||
# network configuration
|
||||
# this assumes that it is a flat network manager
|
||||
$network_manager = 'nova.network.manager.FlatDHCPManager',
|
||||
# this number has been reduced for performance during testing
|
||||
$fixed_range = '10.0.0.0/16',
|
||||
$floating_range = false,
|
||||
$create_networks = true,
|
||||
$num_networks = 1,
|
||||
$multi_host = false,
|
||||
# TODO need to reconsider this design...
|
||||
# this is where the config options that are specific to the network
|
||||
# types go. I am not extremely happy with this....
|
||||
$network_config = {},
|
||||
# I do not think that this needs a bridge?
|
||||
$bridge_ip = '192.168.188.1',
|
||||
$bridge_netmask = '255.255.255.0',
|
||||
$verbose = false,
|
||||
$export_resource = false
|
||||
) {
|
||||
@@ -173,7 +183,6 @@ class openstack::controller(
|
||||
rabbit_password => $rabbit_password,
|
||||
image_service => 'nova.image.glance.GlanceImageService',
|
||||
glance_api_servers => $glance_connection,
|
||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
verbose => $verbose,
|
||||
}
|
||||
|
||||
@@ -193,19 +202,31 @@ class openstack::controller(
|
||||
'nova::cert',
|
||||
'nova::consoleauth',
|
||||
'nova::scheduler',
|
||||
'nova::network',
|
||||
'nova::objectstore',
|
||||
'nova::vncproxy'
|
||||
]:
|
||||
enabled => true,
|
||||
}
|
||||
|
||||
nova::manage::network { 'nova-vm-net':
|
||||
network => '11.0.0.0/24',
|
||||
if $multi_host {
|
||||
nova_config { 'multi_host': value => 'True'; }
|
||||
$enable_network_service = false
|
||||
} else {
|
||||
$enable_network_service = true
|
||||
}
|
||||
|
||||
nova::manage::floating { 'nova-vm-floating':
|
||||
network => '10.128.0.0/24',
|
||||
# set up networking
|
||||
class { 'nova::network':
|
||||
private_interface => $private_interface,
|
||||
public_interface => $public_interface,
|
||||
fixed_range => $fixed_range,
|
||||
floating_range => $floating_range,
|
||||
network_manager => $network_manager,
|
||||
config_overrides => $network_config,
|
||||
create_networks => $create_networks,
|
||||
num_networks => $num_networks,
|
||||
enabled => $enable_network_service,
|
||||
install_service => $enable_network_service,
|
||||
}
|
||||
|
||||
######## Horizon ########
|
||||
|
Reference in New Issue
Block a user