Merge "Added parameters for availability zones configuration"

This commit is contained in:
Jenkins
2014-12-30 18:15:24 +00:00
committed by Gerrit Code Review
2 changed files with 68 additions and 26 deletions

View File

@@ -83,26 +83,41 @@
# The driver that will manage the running instances. # The driver that will manage the running instances.
# Defaults to nova.compute.manager.ComputeManager # Defaults to nova.compute.manager.ComputeManager
# #
# [*default_availability_zone*]
# (optional) Default compute node availability zone.
# Defaults to nova
#
# [*default_schedule_zone*]
# (optional) Availability zone to use when user doesn't specify one.
# Defaults to undef
#
# [*internal_service_availability_zone*]
# (optional) The availability zone to show internal services under.
# Defaults to internal
#
class nova::compute ( class nova::compute (
$enabled = false, $enabled = false,
$manage_service = true, $manage_service = true,
$ensure_package = 'present', $ensure_package = 'present',
$vnc_enabled = true, $vnc_enabled = true,
$vncserver_proxyclient_address = '127.0.0.1', $vncserver_proxyclient_address = '127.0.0.1',
$vncproxy_host = false, $vncproxy_host = false,
$vncproxy_protocol = 'http', $vncproxy_protocol = 'http',
$vncproxy_port = '6080', $vncproxy_port = '6080',
$vncproxy_path = '/vnc_auto.html', $vncproxy_path = '/vnc_auto.html',
$vnc_keymap = 'en-us', $vnc_keymap = 'en-us',
$force_config_drive = false, $force_config_drive = false,
$virtio_nic = false, $virtio_nic = false,
$neutron_enabled = true, $neutron_enabled = true,
$network_device_mtu = undef, $network_device_mtu = undef,
$instance_usage_audit = false, $instance_usage_audit = false,
$instance_usage_audit_period = 'month', $instance_usage_audit_period = 'month',
$force_raw_images = true, $force_raw_images = true,
$reserved_host_memory = '512', $reserved_host_memory = '512',
$compute_manager = 'nova.compute.manager.ComputeManager', $compute_manager = 'nova.compute.manager.ComputeManager',
$default_availability_zone = 'nova',
$default_schedule_zone = undef,
$internal_service_availability_zone = 'internal',
) { ) {
include nova::params include nova::params
@@ -185,4 +200,15 @@ class nova::compute (
nova_config { nova_config {
'DEFAULT/force_raw_images': value => $force_raw_images; 'DEFAULT/force_raw_images': value => $force_raw_images;
} }
nova_config {
'DEFAULT/default_availability_zone': value => $default_availability_zone;
'DEFAULT/internal_service_availability_zone': value => $internal_service_availability_zone;
}
if $default_schedule_zone {
nova_config {
'DEFAULT/default_schedule_zone': value => $default_schedule_zone;
}
}
} }

View File

@@ -36,17 +36,27 @@ describe 'nova::compute' do
) } ) }
it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => true) } it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => true) }
it 'configures availability zones' do
should contain_nova_config('DEFAULT/default_availability_zone').with_value('nova')
should contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('internal')
end
end end
context 'with overridden parameters' do context 'with overridden parameters' do
let :params do let :params do
{ :enabled => true, { :enabled => true,
:ensure_package => '2012.1-2', :ensure_package => '2012.1-2',
:vncproxy_host => '127.0.0.1', :vncproxy_host => '127.0.0.1',
:network_device_mtu => 9999, :network_device_mtu => 9999,
:force_raw_images => false, :force_raw_images => false,
:reserved_host_memory => '0', :reserved_host_memory => '0',
:compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager'} :compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager',
:default_availability_zone => 'az1',
:default_schedule_zone => 'az2',
:internal_service_availability_zone => 'az_int1',
}
end end
it 'installs nova-compute package and service' do it 'installs nova-compute package and service' do
@@ -80,6 +90,12 @@ describe 'nova::compute' do
) )
end end
it 'configures availability zones' do
should contain_nova_config('DEFAULT/default_availability_zone').with_value('az1')
should contain_nova_config('DEFAULT/default_schedule_zone').with_value('az2')
should contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('az_int1')
end
it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => false) } it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => false) }
end end