Merge "Add parameters to nova"

This commit is contained in:
Jenkins
2015-11-24 09:29:50 +00:00
committed by Gerrit Code Review
10 changed files with 106 additions and 19 deletions

View File

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

View File

@@ -115,6 +115,11 @@
# (optional) Config drive format. One of iso9660 (default) or vfat # (optional) Config drive format. One of iso9660 (default) or vfat
# Defaults to undef # 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 ( class nova::compute (
$enabled = true, $enabled = true,
$manage_service = true, $manage_service = true,
@@ -142,6 +147,7 @@ class nova::compute (
$heal_instance_info_cache_interval = '60', $heal_instance_info_cache_interval = '60',
$pci_passthrough = undef, $pci_passthrough = undef,
$config_drive_format = undef, $config_drive_format = undef,
$allow_resize_to_same_host = false,
) { ) {
include ::nova::params include ::nova::params
@@ -150,6 +156,7 @@ class nova::compute (
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory; 'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
'DEFAULT/compute_manager': value => $compute_manager; 'DEFAULT/compute_manager': value => $compute_manager;
'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval; '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) { if ($vnc_enabled) {

View File

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

View File

@@ -13,9 +13,19 @@
# Valid options are none and sasl. # Valid options are none and sasl.
# Defaults to 'none' # 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( class nova::migration::libvirt(
$use_tls = false, $use_tls = false,
$auth = 'none', $auth = 'none',
$live_migration_flag = undef,
$block_migration_flag = undef,
){ ){
if $use_tls { if $use_tls {
$listen_tls = '1' $listen_tls = '1'
@@ -28,6 +38,18 @@ class nova::migration::libvirt(
$listen_tcp = '1' $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.') validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.')
Package['libvirt'] -> File_line<| path == '/etc/libvirt/libvirtd.conf' |> Package['libvirt'] -> File_line<| path == '/etc/libvirt/libvirtd.conf' |>

View File

@@ -75,6 +75,15 @@
# (optional) Second DNS server # (optional) Second DNS server
# Defaults to undef # 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( class nova::network(
$private_interface = undef, $private_interface = undef,
$fixed_range = '10.0.0.0/8', $fixed_range = '10.0.0.0/8',
@@ -91,7 +100,9 @@ class nova::network(
$allowed_start = undef, $allowed_start = undef,
$allowed_end = undef, $allowed_end = undef,
$dns1 = undef, $dns1 = undef,
$dns2 = undef $dns2 = undef,
$multi_host = false,
$auto_assign_floating_ip = false,
) { ) {
include ::nova::params include ::nova::params
@@ -106,7 +117,14 @@ class nova::network(
ensure_resource('sysctl::value', 'net.ipv4.ip_forward', { value => '1' }) ensure_resource('sysctl::value', 'net.ipv4.ip_forward', { value => '1' })
if $floating_range { 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') { 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 { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
it 'configures various stuff' do 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').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/ec2_listen_port').with('value' => '8773')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0') 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/ec2_workers').with('value' => '5')
is_expected.to contain_nova_config('DEFAULT/metadata_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/default_floating_pool').with('value' => 'nova')
is_expected.to contain_nova_config('DEFAULT/fping_path').with('value' => '/usr/sbin/fping')
end end
it 'do not configure v3 api' do it 'do not configure v3 api' do

View File

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

View File

@@ -20,6 +20,8 @@ describe 'nova::conductor' do
:ensure => 'running' :ensure => 'running'
)} )}
it { is_expected.to contain_nova_config('conductor/use_local').with_value('false') }
context 'with manage_service as false' do context 'with manage_service as false' do
let :params do let :params do
{ :enabled => true, { :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')} it { is_expected.to contain_nova_config('libvirt/live_migration_uri').with_value('qemu+tls://%s/system')}
end 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 context 'with auth set to sasl' do
let :params do let :params do
{ {

View File

@@ -91,6 +91,8 @@ describe 'nova::network' do
default_params.merge(:floating_range => '10.0.0.0/30') default_params.merge(:floating_range => '10.0.0.0/30')
end 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/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') } it { is_expected.to contain_nova__manage__floating('nova-vm-floating').with_network('10.0.0.0/30') }
end end
end end