2012-03-30 01:09:50 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'nova::api' do
|
|
|
|
|
|
|
|
let :pre_condition do
|
2016-11-08 01:16:34 -03:00
|
|
|
"include nova
|
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'passw0rd',
|
|
|
|
}"
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
|
|
|
|
2012-10-14 14:26:25 -07:00
|
|
|
let :params do
|
2016-11-08 01:16:34 -03:00
|
|
|
{}
|
2012-10-14 14:26:25 -07:00
|
|
|
end
|
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
shared_examples 'nova-api' do
|
|
|
|
|
|
|
|
context 'with default parameters' do
|
|
|
|
|
2016-07-04 21:47:31 -03:00
|
|
|
it { is_expected.to contain_class('nova::keystone::authtoken') }
|
2016-08-02 19:21:47 +03:00
|
|
|
it { is_expected.to contain_class('cinder::client').that_notifies('Nova::Generic_service[api]') }
|
2016-07-04 21:47:31 -03:00
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
it 'installs nova-api package and service' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_service('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_service],
|
2015-05-20 11:02:10 -07:00
|
|
|
:ensure => 'running',
|
2014-01-30 16:30:43 -05:00
|
|
|
:hasstatus => true,
|
2015-07-22 22:47:49 +02:00
|
|
|
:enable => true,
|
|
|
|
:tag => 'nova-service',
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_package('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_package],
|
|
|
|
:ensure => 'present',
|
2015-07-22 22:47:49 +02:00
|
|
|
:tag => ['openstack', 'nova-package'],
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-11-16 02:55:39 +00:00
|
|
|
is_expected.to contain_package('nova-api').that_requires('Anchor[nova::install::begin]')
|
|
|
|
is_expected.to contain_package('nova-api').that_notifies('Anchor[nova::install::end]')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to_not contain_exec('validate_nova_api')
|
2012-05-08 13:32:36 -05:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
2015-08-14 15:42:16 -04:00
|
|
|
it 'enable metadata in evenlet configuration' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/enabled_apis').with_value('osapi_compute,metadata')
|
|
|
|
end
|
|
|
|
|
2015-10-14 16:36:35 -04:00
|
|
|
it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')}
|
|
|
|
|
2014-01-30 16:30:43 -05:00
|
|
|
it 'configures various stuff' do
|
2016-04-20 16:26:51 -04:00
|
|
|
is_expected.to contain_nova_config('wsgi/api_paste_config').with('value' => 'api-paste.ini')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8774')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '0.0.0.0')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8775')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '0.0.0.0')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '5')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '5')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/fping_path').with('value' => '/usr/sbin/fping')
|
2016-05-18 17:40:30 +03:00
|
|
|
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => '<SERVICE DEFAULT>')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_jsonfile_path').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_providers').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_targets').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_connect_timeout').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_read_timeout').with('value' => '<SERVICE DEFAULT>')
|
2017-03-01 15:36:39 +00:00
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_failure_fatal').with('value' => '<SERVICE DEFAULT>')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/max_limit').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/compute_link_prefix').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/glance_link_prefix').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/hide_server_address_states').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('api/allow_instance_snapshots').with('value' => '<SERVICE DEFAULT>')
|
2016-07-20 15:44:47 +08:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/enable_network_quota').with('value' => '<SERVICE DEFAULT>')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/enable_instance_password').with('value' => '<SERVICE DEFAULT>')
|
2016-07-20 15:44:47 +08:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/password_length').with('value' => '<SERVICE DEFAULT>')
|
2016-09-20 22:43:09 -06:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/allow_resize_to_same_host').with('value' => false)
|
2017-03-27 18:27:48 +03:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/auth_type').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/auth_url').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/os_region_name').with('value' => '<SERVICE DEFAULT>')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/password').with('value' => '<SERVICE DEFAULT>')
|
2017-10-05 10:38:59 -07:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/project_domain_name').with('value' => 'Default')
|
2017-03-27 18:27:48 +03:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/project_name').with('value' => '<SERVICE DEFAULT>')
|
2017-10-05 10:38:59 -07:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/user_domain_name').with('value' => 'Default')
|
2017-03-27 18:27:48 +03:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/username').with('value' => '<SERVICE DEFAULT>')
|
2013-05-03 12:46:59 +02:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it 'unconfigures neutron_metadata proxy' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with(:value => false)
|
|
|
|
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with(:ensure => 'absent')
|
2013-04-26 06:17:03 -04:00
|
|
|
end
|
2017-06-21 23:44:26 -04:00
|
|
|
|
|
|
|
it 'includes nova::pci' do
|
|
|
|
is_expected.to contain_class('nova::pci')
|
|
|
|
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with overridden parameters' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
2017-03-27 18:27:48 +03:00
|
|
|
:enabled => false,
|
|
|
|
:ensure_package => '2012.1-2',
|
|
|
|
:api_bind_address => '192.168.56.210',
|
|
|
|
:metadata_listen => '127.0.0.1',
|
|
|
|
:metadata_listen_port => 8875,
|
|
|
|
:osapi_compute_listen_port => 8874,
|
|
|
|
:use_forwarded_for => false,
|
|
|
|
:ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)',
|
|
|
|
:neutron_metadata_proxy_shared_secret => 'secrete',
|
|
|
|
:osapi_compute_workers => 1,
|
|
|
|
:metadata_workers => 2,
|
|
|
|
:enable_proxy_headers_parsing => true,
|
|
|
|
:metadata_cache_expiration => 15,
|
|
|
|
:vendordata_jsonfile_path => '/tmp',
|
|
|
|
:vendordata_providers => ['StaticJSON', 'DynamicJSON'],
|
|
|
|
:vendordata_dynamic_targets => ['join@http://127.0.0.1:9999/v1/'],
|
|
|
|
:vendordata_dynamic_connect_timeout => 30,
|
|
|
|
:vendordata_dynamic_read_timeout => 30,
|
|
|
|
:vendordata_dynamic_failure_fatal => false,
|
|
|
|
:osapi_max_limit => 1000,
|
|
|
|
:osapi_compute_link_prefix => 'https://10.0.0.1:7777/',
|
|
|
|
:osapi_glance_link_prefix => 'https://10.0.0.1:6666/',
|
|
|
|
:osapi_hide_server_address_states => 'building',
|
|
|
|
:allow_instance_snapshots => true,
|
|
|
|
:enable_network_quota => false,
|
|
|
|
:enable_instance_password => true,
|
|
|
|
:password_length => 12,
|
|
|
|
:allow_resize_to_same_host => true,
|
|
|
|
:vendordata_dynamic_auth_auth_type => 'password',
|
|
|
|
:vendordata_dynamic_auth_auth_url => 'http://127.0.0.1:5000',
|
|
|
|
:vendordata_dynamic_auth_os_region_name => 'RegionOne',
|
|
|
|
:vendordata_dynamic_auth_password => 'secrete',
|
|
|
|
:vendordata_dynamic_auth_project_domain_name => 'Default',
|
|
|
|
:vendordata_dynamic_auth_project_name => 'project',
|
|
|
|
:vendordata_dynamic_auth_user_domain_name => 'Default',
|
|
|
|
:vendordata_dynamic_auth_username => 'user',
|
2014-01-30 16:30:43 -05:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'installs nova-api package and service' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_package('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_package],
|
2014-11-13 11:55:04 -05:00
|
|
|
:ensure => '2012.1-2',
|
2015-07-22 22:47:49 +02:00
|
|
|
:tag => ['openstack', 'nova-package'],
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_service('nova-api').with(
|
2014-01-30 16:30:43 -05:00
|
|
|
:name => platform_params[:nova_api_service],
|
2015-05-20 11:02:10 -07:00
|
|
|
:ensure => 'stopped',
|
2014-01-30 16:30:43 -05:00
|
|
|
:hasstatus => true,
|
2015-07-22 22:47:49 +02:00
|
|
|
:enable => false,
|
|
|
|
:tag => 'nova-service',
|
2014-01-30 16:30:43 -05:00
|
|
|
)
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
|
|
|
it 'configures various stuff' do
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '192.168.56.210')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8874')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '127.0.0.1')
|
2015-09-30 11:06:40 -04:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8875')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '192.168.56.210')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/use_forwarded_for').with('value' => false)
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '1')
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '2')
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '15')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_jsonfile_path').with('value' => '/tmp')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_providers').with('value' => 'StaticJSON,DynamicJSON')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_targets').with('value' => 'join@http://127.0.0.1:9999/v1/')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_connect_timeout').with('value' => '30')
|
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_read_timeout').with('value' => '30')
|
2017-03-01 15:36:39 +00:00
|
|
|
is_expected.to contain_nova_config('api/vendordata_dynamic_failure_fatal').with('value' => false)
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/max_limit').with('value' => '1000')
|
|
|
|
is_expected.to contain_nova_config('api/compute_link_prefix').with('value' => 'https://10.0.0.1:7777/')
|
|
|
|
is_expected.to contain_nova_config('api/glance_link_prefix').with('value' => 'https://10.0.0.1:6666/')
|
2015-03-16 03:05:59 +01:00
|
|
|
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with('value' => true)
|
2017-03-28 11:27:59 +03:00
|
|
|
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with('value' => 'secrete').with_secret(true)
|
2016-05-18 17:40:30 +03:00
|
|
|
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => true)
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/hide_server_address_states').with('value' => 'building')
|
|
|
|
is_expected.to contain_nova_config('api/allow_instance_snapshots').with('value' => true)
|
2016-07-20 15:44:47 +08:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/enable_network_quota').with('value' => false)
|
2017-01-20 21:51:01 +08:00
|
|
|
is_expected.to contain_nova_config('api/enable_instance_password').with('value' => true)
|
2016-07-20 15:44:47 +08:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/password_length').with('value' => '12')
|
2016-09-20 22:43:09 -06:00
|
|
|
is_expected.to contain_nova_config('DEFAULT/allow_resize_to_same_host').with('value' => true)
|
2017-03-27 18:27:48 +03:00
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/auth_type').with('value' => 'password')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/auth_url').with('value' => 'http://127.0.0.1:5000')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/os_region_name').with('value' => 'RegionOne')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/password').with('value' => 'secrete').with_secret(true)
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/project_domain_name').with('value' => 'Default')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/project_name').with('value' => 'project')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/user_domain_name').with('value' => 'Default')
|
|
|
|
is_expected.to contain_nova_config('vendordata_dynamic_auth/username').with('value' => 'user')
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
2017-08-09 15:38:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with pci_alias array' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:pci_alias => [{
|
|
|
|
"vendor_id" => "8086",
|
|
|
|
"product_id" => "0126",
|
|
|
|
"name" => "graphic_card"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"vendor_id" => "9096",
|
|
|
|
"product_id" => "1520",
|
|
|
|
"name" => "network_card"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures nova pci_alias entries' do
|
2017-06-21 23:44:26 -04:00
|
|
|
is_expected.to contain_class('nova::pci')
|
2017-08-09 15:38:49 +01:00
|
|
|
is_expected.to contain_nova_config('pci/alias').with(
|
|
|
|
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2014-05-08 00:56:15 +02:00
|
|
|
|
2017-08-09 15:38:49 +01:00
|
|
|
context 'with pci_alias JSON encoded string (deprecated)' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:pci_alias => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]",
|
|
|
|
})
|
|
|
|
end
|
2015-02-06 23:22:09 +11:00
|
|
|
it 'configures nova pci_alias entries' do
|
2017-06-21 23:44:26 -04:00
|
|
|
is_expected.to contain_class('nova::pci')
|
2017-07-06 15:45:47 +05:30
|
|
|
is_expected.to contain_nova_config('pci/alias').with(
|
2017-08-09 15:38:49 +01:00
|
|
|
'value' => ['{"vendor_id":"8086","product_id":"0126","name":"graphic_card"}','{"vendor_id":"9096","product_id":"1520","name":"network_card"}']
|
2015-02-06 23:22:09 +11:00
|
|
|
)
|
|
|
|
end
|
2012-04-23 19:14:58 -07:00
|
|
|
end
|
2013-05-14 18:44:01 +02:00
|
|
|
|
2017-08-09 15:38:49 +01:00
|
|
|
context 'when pci_alias is empty' do
|
2017-06-21 23:44:26 -04:00
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:pci_alias => ""
|
|
|
|
})
|
2017-08-09 15:38:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'clears pci_alias configuration' do
|
2017-06-21 23:44:26 -04:00
|
|
|
is_expected.to contain_class('nova::pci')
|
2017-08-09 15:38:49 +01:00
|
|
|
is_expected.to contain_nova_config('pci/alias').with(:value => '<SERVICE DEFAULT>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-06 23:22:59 -04:00
|
|
|
context 'while validating the service with default command' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:validate => true,
|
|
|
|
})
|
|
|
|
end
|
2017-07-13 12:59:31 -06:00
|
|
|
it { is_expected.to contain_openstacklib__service_validation('nova-api').with(
|
2016-11-01 16:22:08 +08:00
|
|
|
:command => 'nova --os-auth-url http://127.0.0.1:5000/ --os-project-name services --os-username nova --os-password passw0rd flavor-list',
|
2017-07-13 12:59:31 -06:00
|
|
|
:subscribe => 'Service[nova-api]',
|
2014-10-06 23:22:59 -04:00
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'while validating the service with custom command' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:validate => true,
|
|
|
|
:validation_options => { 'nova-api' => { 'command' => 'my-script' } }
|
|
|
|
})
|
|
|
|
end
|
2017-07-13 12:59:31 -06:00
|
|
|
it { is_expected.to contain_openstacklib__service_validation('nova-api').with(
|
2016-11-01 16:22:08 +08:00
|
|
|
:command => 'my-script',
|
2017-07-13 12:59:31 -06:00
|
|
|
:subscribe => 'Service[nova-api]',
|
2014-10-06 23:22:59 -04:00
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
2014-01-13 22:58:10 -06:00
|
|
|
context 'while not managing service state' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
2016-11-01 16:22:08 +08:00
|
|
|
:enabled => false,
|
|
|
|
:manage_service => false,
|
2014-01-13 22:58:10 -06:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to contain_service('nova-api').without_ensure }
|
2014-01-13 22:58:10 -06:00
|
|
|
end
|
2014-11-19 23:11:34 -05:00
|
|
|
|
|
|
|
context 'with default database parameters' do
|
|
|
|
let :pre_condition do
|
2016-11-08 01:16:34 -03:00
|
|
|
"include nova
|
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}"
|
2014-11-19 23:11:34 -05:00
|
|
|
end
|
|
|
|
|
2015-03-16 03:05:59 +01:00
|
|
|
it { is_expected.to_not contain_nova_config('database/connection') }
|
|
|
|
it { is_expected.to_not contain_nova_config('database/slave_connection') }
|
2016-01-29 17:39:33 -05:00
|
|
|
it { is_expected.to_not contain_nova_config('api_database/connection') }
|
|
|
|
it { is_expected.to_not contain_nova_config('api_database/slave_connection') }
|
2015-11-23 20:37:52 +00:00
|
|
|
it { is_expected.to_not contain_nova_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
2014-11-19 23:11:34 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with overridden database parameters' do
|
|
|
|
let :pre_condition do
|
|
|
|
"class { 'nova':
|
2016-01-29 17:39:33 -05:00
|
|
|
database_connection => 'mysql://user:pass@db/db1',
|
|
|
|
slave_connection => 'mysql://user:pass@slave/db1',
|
|
|
|
api_database_connection => 'mysql://user:pass@db/db2',
|
|
|
|
api_slave_connection => 'mysql://user:pass@slave/db2',
|
|
|
|
database_idle_timeout => '30',
|
2014-11-19 23:11:34 -05:00
|
|
|
}
|
2016-11-08 01:16:34 -03:00
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'passw0rd',
|
|
|
|
}
|
2014-11-19 23:11:34 -05:00
|
|
|
"
|
|
|
|
end
|
|
|
|
|
2016-01-29 17:39:33 -05:00
|
|
|
it { is_expected.to contain_nova_config('api_database/connection').with_value('mysql://user:pass@db/db2').with_secret(true) }
|
|
|
|
it { is_expected.to contain_nova_config('api_database/slave_connection').with_value('mysql://user:pass@slave/db2').with_secret(true) }
|
2017-04-10 20:03:52 +08:00
|
|
|
it { is_expected.to contain_oslo__db('nova_config').with(
|
|
|
|
:connection => 'mysql://user:pass@db/db1',
|
|
|
|
:slave_connection => 'mysql://user:pass@slave/db1',
|
|
|
|
:idle_timeout => '30',
|
|
|
|
)}
|
2014-11-19 23:11:34 -05:00
|
|
|
end
|
|
|
|
|
2015-10-14 16:36:35 -04:00
|
|
|
context 'with custom instance_name_template' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:instance_name_template => 'instance-%08x',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
it 'configures instance_name_template' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_value('instance-%08x');
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-14 15:42:16 -04:00
|
|
|
context 'when running nova API in wsgi compute, and enabling metadata' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :service_name => 'httpd' })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
2016-11-08 01:16:34 -03:00
|
|
|
include ::nova
|
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}"
|
2015-08-14 15:42:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'enable nova API service' do
|
|
|
|
is_expected.to contain_service('nova-api').with(
|
2016-11-01 16:22:08 +08:00
|
|
|
:ensure => 'running',
|
|
|
|
:name => platform_params[:nova_api_service],
|
|
|
|
:enable => true,
|
|
|
|
:tag => 'nova-service',
|
2015-08-14 15:42:16 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
it 'enable metadata in evenlet configuration' do
|
|
|
|
is_expected.to contain_nova_config('DEFAULT/enabled_apis').with_value('metadata')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when running nova API in wsgi for compute, and disabling metadata' do
|
|
|
|
before do
|
|
|
|
params.merge!({
|
|
|
|
:service_name => 'httpd',
|
|
|
|
:enabled_apis => ['osapi_compute'] })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
2016-11-08 01:16:34 -03:00
|
|
|
include ::nova
|
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}"
|
2015-08-14 15:42:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'disable nova API service' do
|
|
|
|
is_expected.to contain_service('nova-api').with(
|
2016-11-01 16:22:08 +08:00
|
|
|
:ensure => 'stopped',
|
|
|
|
:name => platform_params[:nova_api_service],
|
|
|
|
:enable => false,
|
|
|
|
:tag => 'nova-service',
|
2015-08-14 15:42:16 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-02 19:21:47 +03:00
|
|
|
context 'when disabling cinder client installation' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :install_cinder_client => false })
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to_not contain_class('cinder::client') }
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-08-14 15:42:16 -04:00
|
|
|
context 'when service_name is not valid' do
|
|
|
|
before do
|
|
|
|
params.merge!({ :service_name => 'foobar' })
|
|
|
|
end
|
|
|
|
|
|
|
|
let :pre_condition do
|
|
|
|
"include ::apache
|
2016-11-08 01:16:34 -03:00
|
|
|
include ::nova
|
|
|
|
class { '::nova::keystone::authtoken':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}"
|
2015-08-14 15:42:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it_raises 'a Puppet::Error', /Invalid service_name/
|
|
|
|
end
|
|
|
|
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
2016-06-07 00:59:36 -03:00
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
let (:facts) do
|
2016-10-07 14:55:23 +03:00
|
|
|
facts.merge!(OSDefaults.get_facts({ :os_workers => 5 }))
|
2016-06-07 00:59:36 -03:00
|
|
|
end
|
2014-01-30 16:30:43 -05:00
|
|
|
|
2016-06-07 00:59:36 -03:00
|
|
|
let (:platform_params) do
|
|
|
|
case facts[:osfamily]
|
|
|
|
when 'Debian'
|
|
|
|
{ :nova_api_package => 'nova-api',
|
|
|
|
:nova_api_service => 'nova-api' }
|
|
|
|
when 'RedHat'
|
|
|
|
{ :nova_api_package => 'openstack-nova-api',
|
|
|
|
:nova_api_service => 'openstack-nova-api' }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
it_behaves_like 'nova-api'
|
2014-01-30 16:30:43 -05:00
|
|
|
end
|
|
|
|
end
|
2012-03-30 01:09:50 -07:00
|
|
|
end
|