Add parameters to nova

Added options:

	api_paste_config
	fping_path
	allow_resize_to_same_host
	use_local
	live_migration_flag
	block_migration_flag
	multi_host
	auto_assign_floating_ip

Change-Id: I4665344bb0049fe2b7080c2f4dbca01e011f4f1d
This commit is contained in:
Mykyta Karpin 2015-11-04 12:07:10 +02:00
parent aabb4e9c54
commit 57af0e23a2
10 changed files with 106 additions and 19 deletions

View File

@ -11,6 +11,10 @@
# (optional) Whether the nova api service will be run
# Defaults to true
#
# [*api_paste_config*]
# (optional) File name for the paste.deploy config for nova-api
# Defaults to 'api-paste.ini'
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
@ -150,6 +154,10 @@
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to false
#
# [*fping_path*]
# (optional) Full path to fping.
# Defaults to '/usr/sbin/fping'
#
# [*validation_options*]
# (optional) Service validation options
# Should be a hash of options defined in openstacklib::service_validation
@ -170,6 +178,7 @@ class nova::api(
$admin_password,
$enabled = true,
$manage_service = true,
$api_paste_config = 'api-paste.ini',
$ensure_package = 'present',
$auth_uri = false,
$identity_uri = false,
@ -199,6 +208,7 @@ class nova::api(
$validate = false,
$validation_options = {},
$instance_name_template = undef,
$fping_path = '/usr/sbin/fping',
# DEPRECATED PARAMETER
$auth_protocol = 'http',
$auth_port = 35357,
@ -246,6 +256,7 @@ class nova::api(
nova_config {
'DEFAULT/enabled_apis': value => $enabled_apis;
'DEFAULT/api_paste_config': value => $api_paste_config;
'DEFAULT/volume_api_class': value => $volume_api_class;
'DEFAULT/ec2_listen': value => $api_bind_address;
'DEFAULT/ec2_listen_port': value => $ec2_listen_port;
@ -259,6 +270,7 @@ class nova::api(
'DEFAULT/metadata_workers': value => $metadata_workers;
'DEFAULT/use_forwarded_for': value => $use_forwarded_for;
'DEFAULT/default_floating_pool': value => $default_floating_pool;
'DEFAULT/fping_path': value => $fping_path;
'osapi_v3/enabled': value => $osapi_v3;
}

View File

@ -115,6 +115,11 @@
# (optional) Config drive format. One of iso9660 (default) or vfat
# Defaults to undef
#
# [*allow_resize_to_same_host*]
# (optional) Allow destination machine to match source for resize.
# Useful when testing in single-host environments.
# Defaults to false
#
class nova::compute (
$enabled = true,
$manage_service = true,
@ -142,6 +147,7 @@ class nova::compute (
$heal_instance_info_cache_interval = '60',
$pci_passthrough = undef,
$config_drive_format = undef,
$allow_resize_to_same_host = false,
) {
include ::nova::params
@ -150,6 +156,7 @@ class nova::compute (
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
'DEFAULT/compute_manager': value => $compute_manager;
'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval;
'DEFAULT/allow_resize_to_same_host': value => $allow_resize_to_same_host;
}
if ($vnc_enabled) {

View File

@ -20,11 +20,16 @@
# (optional) Number of workers for OpenStack Conductor service
# Defaults to undef (i.e. parameter will not be present)
#
# [*use_local*]
# (optional) Perform nova-conductor operations locally
# Defaults to false
#
class nova::conductor(
$enabled = true,
$manage_service = true,
$ensure_package = 'present',
$workers = undef,
$use_local = false,
) {
include ::nova::db
@ -43,4 +48,8 @@ class nova::conductor(
'conductor/workers': value => $workers;
}
}
nova_config {
'conductor/use_local': value => $use_local;
}
}

View File

@ -13,9 +13,19 @@
# Valid options are none and sasl.
# Defaults to 'none'
#
# [*live_migration_flag*]
# (optional) Migration flags to be set for live migration (string value)
# Defaults to undef
#
# [*block_migration_flag*]
# (optional) Migration flags to be set for block migration (string value)
# Defaults to undef
#
class nova::migration::libvirt(
$use_tls = false,
$auth = 'none',
$use_tls = false,
$auth = 'none',
$live_migration_flag = undef,
$block_migration_flag = undef,
){
if $use_tls {
$listen_tls = '1'
@ -28,6 +38,18 @@ class nova::migration::libvirt(
$listen_tcp = '1'
}
if $live_migration_flag {
nova_config {
'libvirt/live_migration_flag': value => $live_migration_flag
}
}
if $block_migration_flag {
nova_config {
'libvirt/block_migration_flag': value => $block_migration_flag
}
}
validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.')
Package['libvirt'] -> File_line<| path == '/etc/libvirt/libvirtd.conf' |>

View File

@ -75,23 +75,34 @@
# (optional) Second DNS server
# Defaults to undef
#
# [*multi_host*]
# (optional) Default value for multi_host in networks.
# Also, if set, some rpc network calls will be sent directly to host.
# Defaults to false.
#
# [*auto_assign_floating_ip*]
# (optional) Autoassigning floating IP to VM
# Defaults to false.
#
class nova::network(
$private_interface = undef,
$fixed_range = '10.0.0.0/8',
$public_interface = undef,
$num_networks = 1,
$network_size = 255,
$floating_range = false,
$enabled = true,
$network_manager = 'nova.network.manager.FlatDHCPManager',
$config_overrides = {},
$create_networks = true,
$ensure_package = 'present',
$install_service = true,
$allowed_start = undef,
$allowed_end = undef,
$dns1 = undef,
$dns2 = undef
$private_interface = undef,
$fixed_range = '10.0.0.0/8',
$public_interface = undef,
$num_networks = 1,
$network_size = 255,
$floating_range = false,
$enabled = true,
$network_manager = 'nova.network.manager.FlatDHCPManager',
$config_overrides = {},
$create_networks = true,
$ensure_package = 'present',
$install_service = true,
$allowed_start = undef,
$allowed_end = undef,
$dns1 = undef,
$dns2 = undef,
$multi_host = false,
$auto_assign_floating_ip = false,
) {
include ::nova::params
@ -106,7 +117,14 @@ class nova::network(
ensure_resource('sysctl::value', 'net.ipv4.ip_forward', { value => '1' })
if $floating_range {
nova_config { 'DEFAULT/floating_range': value => $floating_range }
nova_config {
'DEFAULT/floating_range': value => $floating_range;
'DEFAULT/auto_assign_floating_ip': value => $auto_assign_floating_ip;
}
}
nova_config {
'DEFAULT/multi_host': value => $multi_host;
}
if has_key($config_overrides, 'vlan_start') {

View File

@ -59,6 +59,7 @@ describe 'nova::api' do
it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
it 'configures various stuff' do
is_expected.to contain_nova_config('DEFAULT/api_paste_config').with('value' => 'api-paste.ini')
is_expected.to contain_nova_config('DEFAULT/ec2_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/ec2_listen_port').with('value' => '8773')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0')
@ -70,6 +71,7 @@ describe 'nova::api' do
is_expected.to contain_nova_config('DEFAULT/ec2_workers').with('value' => '5')
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '5')
is_expected.to contain_nova_config('DEFAULT/default_floating_pool').with('value' => 'nova')
is_expected.to contain_nova_config('DEFAULT/fping_path').with('value' => '/usr/sbin/fping')
end
it 'do not configure v3 api' do

View File

@ -25,8 +25,10 @@ describe 'nova::compute' do
end
it { is_expected.to contain_nova_config('DEFAULT/network_device_mtu').with(:ensure => 'absent') }
it { is_expected.to contain_nova_config('DEFAULT/allow_resize_to_same_host').with(:value => 'false') }
it { is_expected.to_not contain_nova_config('DEFAULT/novncproxy_base_url') }
it { is_expected.to_not contain_package('bridge-utils').with(
:ensure => 'present',
:before => 'Nova::Generic_service[compute]'

View File

@ -20,6 +20,8 @@ describe 'nova::conductor' do
:ensure => 'running'
)}
it { is_expected.to contain_nova_config('conductor/use_local').with_value('false') }
context 'with manage_service as false' do
let :params do
{ :enabled => true,

View File

@ -51,6 +51,17 @@ describe 'nova::migration::libvirt' do
it { is_expected.to contain_nova_config('libvirt/live_migration_uri').with_value('qemu+tls://%s/system')}
end
context 'with migration flags set' do
let :params do
{
:live_migration_flag => 'live migration flag',
:block_migration_flag => 'block migration flag',
}
end
it { is_expected.to contain_nova_config('libvirt/live_migration_flag').with(:value => 'live migration flag') }
it { is_expected.to contain_nova_config('libvirt/block_migration_flag').with(:value => 'block migration flag') }
end
context 'with auth set to sasl' do
let :params do
{

View File

@ -91,6 +91,8 @@ describe 'nova::network' do
default_params.merge(:floating_range => '10.0.0.0/30')
end
it { is_expected.to contain_nova_config('DEFAULT/floating_range').with_value('10.0.0.0/30') }
it { is_expected.to contain_nova_config('DEFAULT/auto_assign_floating_ip').with_value('false') }
it { is_expected.to contain_nova_config('DEFAULT/multi_host').with_value('false') }
it { is_expected.to contain_nova__manage__floating('nova-vm-floating').with_network('10.0.0.0/30') }
end
end