3 describe 'nova::compute' do
9 shared_examples 'nova-compute' do
11 context 'with default parameters' do
13 it 'installs nova-compute package and service' do
14 should contain_service('nova-compute').with({
15 :name => platform_params[:nova_compute_service],
20 should contain_package('nova-compute').with({
21 :name => platform_params[:nova_compute_package],
22 :tag => ['openstack', 'nova']
26 it { should contain_nova_config('DEFAULT/network_device_mtu').with(:ensure => 'absent') }
27 it { should_not contain_nova_config('DEFAULT/novncproxy_base_url') }
29 it { should_not contain_package('bridge-utils').with(
31 :before => 'Nova::Generic_service[compute]'
34 it { should contain_package('pm-utils').with(
38 it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => true) }
40 it 'configures availability zones' do
41 should contain_nova_config('DEFAULT/default_availability_zone').with_value('nova')
42 should contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('internal')
47 context 'with overridden parameters' do
50 :ensure_package => '2012.1-2',
51 :vncproxy_host => '127.0.0.1',
52 :network_device_mtu => 9999,
53 :force_raw_images => false,
54 :reserved_host_memory => '0',
55 :compute_manager => 'ironic.nova.compute.manager.ClusteredComputeManager',
56 :pci_passthrough => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]",
57 :default_availability_zone => 'az1',
58 :default_schedule_zone => 'az2',
59 :internal_service_availability_zone => 'az_int1',
63 it 'installs nova-compute package and service' do
64 should contain_service('nova-compute').with({
65 :name => platform_params[:nova_compute_service],
70 should contain_package('nova-compute').with({
71 :name => platform_params[:nova_compute_package],
72 :ensure => '2012.1-2',
73 :tag => ['openstack', 'nova']
77 it 'configures ironic in nova.conf' do
78 should contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('0')
79 should contain_nova_config('DEFAULT/compute_manager').with_value('ironic.nova.compute.manager.ClusteredComputeManager')
82 it 'configures network_device_mtu' do
83 should contain_nova_config('DEFAULT/network_device_mtu').with_value('9999')
86 it 'configures vnc in nova.conf' do
87 should contain_nova_config('DEFAULT/vnc_enabled').with_value(true)
88 should contain_nova_config('DEFAULT/vncserver_proxyclient_address').with_value('127.0.0.1')
89 should contain_nova_config('DEFAULT/novncproxy_base_url').with_value(
90 'http://127.0.0.1:6080/vnc_auto.html'
94 it 'configures availability zones' do
95 should contain_nova_config('DEFAULT/default_availability_zone').with_value('az1')
96 should contain_nova_config('DEFAULT/default_schedule_zone').with_value('az2')
97 should contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('az_int1')
100 it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => false) }
102 it 'configures nova pci_passthrough_whitelist entries' do
103 should contain_nova_config('DEFAULT/pci_passthrough_whitelist').with(
104 'value' => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"physical_network\":\"physnet1\"}]"
109 context 'with neutron_enabled set to false' do
111 { :neutron_enabled => false }
114 it 'installs bridge-utils package for nova-network' do
115 should contain_package('bridge-utils').with(
116 :ensure => 'present',
117 :before => 'Nova::Generic_service[compute]'
122 context 'with vnc_enabled set to false' do
124 { :vnc_enabled => false }
127 it 'disables vnc in nova.conf' do
128 should contain_nova_config('DEFAULT/vnc_enabled').with_value(false)
129 should contain_nova_config('DEFAULT/vncserver_proxyclient_address').with_value('127.0.0.1')
130 should_not contain_nova_config('DEFAULT/novncproxy_base_url')
134 context 'with force_config_drive parameter set to true' do
136 { :force_config_drive => true }
139 it { should contain_nova_config('DEFAULT/force_config_drive').with_value(true) }
142 context 'while not managing service state' do
145 :manage_service => false,
149 it { should contain_service('nova-compute').without_ensure }
152 context 'with instance_usage_audit parameter set to false' do
154 { :instance_usage_audit => false, }
157 it { should contain_nova_config('DEFAULT/instance_usage_audit').with_ensure('absent') }
158 it { should contain_nova_config('DEFAULT/instance_usage_audit_period').with_ensure('absent') }
161 context 'with instance_usage_audit parameter and wrong period' do
163 { :instance_usage_audit => true,
164 :instance_usage_audit_period => 'fake', }
167 it { should contain_nova_config('DEFAULT/instance_usage_audit').with_ensure('absent') }
168 it { should contain_nova_config('DEFAULT/instance_usage_audit_period').with_ensure('absent') }
171 context 'with instance_usage_audit parameter and period' do
173 { :instance_usage_audit => true,
174 :instance_usage_audit_period => 'year', }
177 it { should contain_nova_config('DEFAULT/instance_usage_audit').with_value(true) }
178 it { should contain_nova_config('DEFAULT/instance_usage_audit_period').with_value('year') }
180 context 'with vnc_keymap set to fr' do
182 { :vnc_keymap => 'fr', }
185 it { should contain_nova_config('DEFAULT/vnc_keymap').with_value('fr') }
190 context 'on Debian platforms' do
192 { :osfamily => 'Debian' }
195 let :platform_params do
196 { :nova_compute_package => 'nova-compute',
197 :nova_compute_service => 'nova-compute' }
200 it_behaves_like 'nova-compute'
203 context 'on RedHat platforms' do
205 { :osfamily => 'RedHat' }
208 let :platform_params do
209 { :nova_compute_package => 'openstack-nova-compute',
210 :nova_compute_service => 'openstack-nova-compute' }
213 it_behaves_like 'nova-compute'