diff --git a/manifests/compute.pp b/manifests/compute.pp index 0fcf648fc..1becd1c52 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -83,26 +83,41 @@ # The driver that will manage the running instances. # 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 ( - $enabled = false, - $manage_service = true, - $ensure_package = 'present', - $vnc_enabled = true, - $vncserver_proxyclient_address = '127.0.0.1', - $vncproxy_host = false, - $vncproxy_protocol = 'http', - $vncproxy_port = '6080', - $vncproxy_path = '/vnc_auto.html', - $vnc_keymap = 'en-us', - $force_config_drive = false, - $virtio_nic = false, - $neutron_enabled = true, - $network_device_mtu = undef, - $instance_usage_audit = false, - $instance_usage_audit_period = 'month', - $force_raw_images = true, - $reserved_host_memory = '512', - $compute_manager = 'nova.compute.manager.ComputeManager', + $enabled = false, + $manage_service = true, + $ensure_package = 'present', + $vnc_enabled = true, + $vncserver_proxyclient_address = '127.0.0.1', + $vncproxy_host = false, + $vncproxy_protocol = 'http', + $vncproxy_port = '6080', + $vncproxy_path = '/vnc_auto.html', + $vnc_keymap = 'en-us', + $force_config_drive = false, + $virtio_nic = false, + $neutron_enabled = true, + $network_device_mtu = undef, + $instance_usage_audit = false, + $instance_usage_audit_period = 'month', + $force_raw_images = true, + $reserved_host_memory = '512', + $compute_manager = 'nova.compute.manager.ComputeManager', + $default_availability_zone = 'nova', + $default_schedule_zone = undef, + $internal_service_availability_zone = 'internal', ) { include nova::params @@ -185,4 +200,15 @@ class nova::compute ( nova_config { '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; + } + } } diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index 0411af534..47ef91c52 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -36,17 +36,27 @@ describe 'nova::compute' do ) } 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 context 'with overridden parameters' do let :params do - { :enabled => true, - :ensure_package => '2012.1-2', - :vncproxy_host => '127.0.0.1', - :network_device_mtu => 9999, - :force_raw_images => false, - :reserved_host_memory => '0', - :compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager'} + { :enabled => true, + :ensure_package => '2012.1-2', + :vncproxy_host => '127.0.0.1', + :network_device_mtu => 9999, + :force_raw_images => false, + :reserved_host_memory => '0', + :compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager', + :default_availability_zone => 'az1', + :default_schedule_zone => 'az2', + :internal_service_availability_zone => 'az_int1', + } end it 'installs nova-compute package and service' do @@ -80,6 +90,12 @@ describe 'nova::compute' do ) 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) } end