Add optional auto_assign_floating_ip parameter.

This commit is contained in:
Wong Hoi Sing Edison
2012-06-20 11:41:23 +08:00
parent 90dffc1364
commit b8c7b9a556
3 changed files with 69 additions and 49 deletions

View File

@@ -16,25 +16,27 @@ file { '/tmp/test_nova.sh':
# environments # environments
# assumes that eth0 is the public interface # assumes that eth0 is the public interface
$public_interface = 'eth0' $public_interface = 'eth0'
# assumes that eth1 is the interface that will be used for the vm network # assumes that eth1 is the interface that will be used for the vm network
# this configuration assumes this interface is active but does not have an # this configuration assumes this interface is active but does not have an
# ip address allocated to it. # ip address allocated to it.
$private_interface = 'eth1' $private_interface = 'eth1'
# credentials # credentials
$admin_email = 'root@localhost' $admin_email = 'root@localhost'
$admin_password = 'keystone_admin' $admin_password = 'keystone_admin'
$keystone_db_password = 'keystone_db_pass' $keystone_db_password = 'keystone_db_pass'
$keystone_admin_token = 'keystone_admin_token' $keystone_admin_token = 'keystone_admin_token'
$nova_db_password = 'nova_pass' $nova_db_password = 'nova_pass'
$nova_user_password = 'nova_pass' $nova_user_password = 'nova_pass'
$glance_db_password = 'glance_pass' $glance_db_password = 'glance_pass'
$glance_user_password = 'glance_pass' $glance_user_password = 'glance_pass'
$rabbit_password = 'openstack_rabbit_password' $rabbit_password = 'openstack_rabbit_password'
$rabbit_user = 'openstack_rabbit_user' $rabbit_user = 'openstack_rabbit_user'
$fixed_network_range = '10.0.0.0/24' $fixed_network_range = '10.0.0.0/24'
# switch this to true to have all service log at verbose # switch this to true to have all service log at verbose
$verbose = 'false' $verbose = 'false'
# by default it does not enable atomatically adding floating IPs
$auto_assign_floating_ip = 'false'
#### end shared variables ################# #### end shared variables #################
@@ -44,22 +46,23 @@ $verbose = 'false'
node /openstack_all/ { node /openstack_all/ {
class { 'openstack::all': class { 'openstack::all':
public_address => $ipaddress_eth0, public_address => $ipaddress_eth0,
public_interface => $public_interface, public_interface => $public_interface,
private_interface => $private_interface, private_interface => $private_interface,
admin_email => $admin_email, admin_email => $admin_email,
admin_password => $admin_password, admin_password => $admin_password,
keystone_db_password => $keystone_db_password, keystone_db_password => $keystone_db_password,
keystone_admin_token => $keystone_admin_token, keystone_admin_token => $keystone_admin_token,
nova_db_password => $nova_db_password, nova_db_password => $nova_db_password,
nova_user_password => $nova_user_password, nova_user_password => $nova_user_password,
glance_db_password => $glance_db_password, glance_db_password => $glance_db_password,
glance_user_password => $glance_user_password, glance_user_password => $glance_user_password,
rabbit_password => $rabbit_password, rabbit_password => $rabbit_password,
rabbit_user => $rabbit_user, rabbit_user => $rabbit_user,
libvirt_type => 'kvm', libvirt_type => 'kvm',
fixed_range => $fixed_network_range, fixed_range => $fixed_network_range,
verbose => $verbose, verbose => $verbose,
auto_assign_floating_ip => $auto_assign_floating_ip,
} }
class { 'openstack::auth_file': class { 'openstack::auth_file':
@@ -96,6 +99,7 @@ node /openstack_controller/ {
# by default is assumes flat dhcp networking mode # by default is assumes flat dhcp networking mode
network_manager => 'nova.network.manager.FlatDHCPManager', network_manager => 'nova.network.manager.FlatDHCPManager',
verbose => $verbose, verbose => $verbose,
auto_assign_floating_ip => $auto_assign_floating_ip,
mysql_root_password => $mysql_root_password, mysql_root_password => $mysql_root_password,
admin_email => $admin_email, admin_email => $admin_email,
admin_password => $admin_password, admin_password => $admin_password,

View File

@@ -15,6 +15,9 @@
# [fixed_range] The fixed private ip range to be created for the private VM network. Optional. Defaults to '10.0.0.0/24'. # [fixed_range] The fixed private ip range to be created for the private VM network. Optional. Defaults to '10.0.0.0/24'.
# [network_manager] The network manager to use for the nova network service. # [network_manager] The network manager to use for the nova network service.
# Optional. Defaults to 'nova.network.manager.FlatDHCPManager'. # Optional. Defaults to 'nova.network.manager.FlatDHCPManager'.
# [auto_assign_floating_ip] Rather configured to automatically allocate and
# assign a floating IP address to virtual instances when they are launched.
# Defaults to false.
# [network_config] Used to specify network manager specific parameters .Optional. Defualts to {}. # [network_config] Used to specify network manager specific parameters .Optional. Defualts to {}.
# [mysql_root_password] The root password to set for the mysql database. Optional. Defaults to sql_pass'. # [mysql_root_password] The root password to set for the mysql database. Optional. Defaults to sql_pass'.
# [rabbit_password] The password to use for the rabbitmq user. Optional. Defaults to rabbit_pw' # [rabbit_password] The password to use for the rabbitmq user. Optional. Defaults to rabbit_pw'
@@ -53,28 +56,29 @@ class openstack::all(
$public_address, $public_address,
$public_interface, $public_interface,
$private_interface, $private_interface,
$floating_range = false, $floating_range = false,
$fixed_range = '10.0.0.0/24', $fixed_range = '10.0.0.0/24',
$network_manager = 'nova.network.manager.FlatDHCPManager', $network_manager = 'nova.network.manager.FlatDHCPManager',
$network_config = {}, $network_config = {},
# middleware credentials # middleware credentials
$mysql_root_password = 'sql_pass', $mysql_root_password = 'sql_pass',
$rabbit_password = 'rabbit_pw', $rabbit_password = 'rabbit_pw',
$rabbit_user = 'nova', $rabbit_user = 'nova',
# opestack credentials # opestack credentials
$admin_email = 'someuser@some_fake_email_address.foo', $admin_email = 'someuser@some_fake_email_address.foo',
$admin_password = 'ChangeMe', $admin_password = 'ChangeMe',
$keystone_db_password = 'keystone_pass', $keystone_db_password = 'keystone_pass',
$keystone_admin_token = 'keystone_admin_token', $keystone_admin_token = 'keystone_admin_token',
$nova_db_password = 'nova_pass', $nova_db_password = 'nova_pass',
$nova_user_password = 'nova_pass', $nova_user_password = 'nova_pass',
$glance_db_password = 'glance_pass', $glance_db_password = 'glance_pass',
$glance_user_password = 'glance_pass', $glance_user_password = 'glance_pass',
# config # config
$verbose = false, $verbose = false,
$purge_nova_config = true, $auto_assign_floating_ip = false,
$libvirt_type = 'kvm', $purge_nova_config = true,
$nova_volume = 'nova-volumes' $libvirt_type = 'kvm',
$nova_volume = 'nova-volumes'
) { ) {
@@ -211,6 +215,10 @@ class openstack::all(
create_networks => true, create_networks => true,
} }
if $auto_assign_floating_ip {
nova_config { 'auto_assign_floating_ip': value => 'True'; }
}
# a bunch of nova services that require no configuration # a bunch of nova services that require no configuration
class { [ class { [
'nova::scheduler', 'nova::scheduler',

View File

@@ -26,6 +26,9 @@
# [num_networks] Number of networks that fixed range should be split into. # [num_networks] Number of networks that fixed range should be split into.
# [multi_host] Rather node should support multi-host networking mode for HA. # [multi_host] Rather node should support multi-host networking mode for HA.
# Optional. Defaults to false. # Optional. Defaults to false.
# [auto_assign_floating_ip] Rather configured to automatically allocate and
# assign a floating IP address to virtual instances when they are launched.
# Defaults to false.
# [network_config] Hash that can be used to pass implementation specifc # [network_config] Hash that can be used to pass implementation specifc
# network settings. Optioal. Defaults to {} # network settings. Optioal. Defaults to {}
# [verbose] Rahter to log services at verbose. # [verbose] Rahter to log services at verbose.
@@ -68,6 +71,7 @@ class openstack::controller(
$create_networks = true, $create_networks = true,
$num_networks = 1, $num_networks = 1,
$multi_host = false, $multi_host = false,
$auto_assign_floating_ip = false,
# TODO need to reconsider this design... # TODO need to reconsider this design...
# this is where the config options that are specific to the network # this is where the config options that are specific to the network
# types go. I am not extremely happy with this.... # types go. I am not extremely happy with this....
@@ -269,6 +273,10 @@ class openstack::controller(
install_service => $enable_network_service, install_service => $enable_network_service,
} }
if $auto_assign_floating_ip {
nova_config { 'auto_assign_floating_ip': value => 'True'; }
}
######## Horizon ######## ######## Horizon ########
class { 'memcached': class { 'memcached':