Move availability zone parameters to their own class.
Several nova-* services require these parameters, nova::compute is too specific for these parameters and may not be included on all nodes. Change-Id: Iec4ace333a0f33118609267aab5c0974f62807df Closes-Bug: #1529065
This commit is contained in:
parent
cdebe16ead
commit
605a9d90e2
|
@ -0,0 +1,43 @@
|
|||
# == Class: nova::availability_zone
|
||||
#
|
||||
# nova availability zone configuration
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*default_availability_zone*]
|
||||
# (optional) Default compute node availability zone.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*default_schedule_zone*]
|
||||
# (optional) Availability zone to use when user doesn't specify one.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*internal_service_availability_zone*]
|
||||
# (optional) The availability zone to show internal services under.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class nova::availability_zone (
|
||||
$default_availability_zone = $::os_service_default,
|
||||
$default_schedule_zone = $::os_service_default,
|
||||
$internal_service_availability_zone = $::os_service_default,
|
||||
) {
|
||||
|
||||
# NOTE(dalees): In order to keep backward compatibility from nova::compute we
|
||||
# rely on the pick function.
|
||||
$default_availability_zone_real = pick(
|
||||
$::nova::compute::default_availability_zone,
|
||||
$default_availability_zone)
|
||||
$default_schedule_zone_real = pick(
|
||||
$::nova::compute::default_schedule_zone,
|
||||
$default_schedule_zone)
|
||||
$internal_service_availability_zone_real = pick(
|
||||
$::nova::compute::internal_service_availability_zone,
|
||||
$internal_service_availability_zone)
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/default_availability_zone': value => $default_availability_zone_real;
|
||||
'DEFAULT/default_schedule_zone': value => $default_schedule_zone_real;
|
||||
'DEFAULT/internal_service_availability_zone': value => $internal_service_availability_zone_real;
|
||||
}
|
||||
|
||||
}
|
|
@ -92,18 +92,6 @@
|
|||
# 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
|
||||
#
|
||||
# [*pci_passthrough*]
|
||||
# (optional) Pci passthrough hash in format of:
|
||||
# Defaults to undef
|
||||
|
@ -120,6 +108,20 @@
|
|||
# Useful when testing in single-host environments.
|
||||
# Defaults to false
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*default_availability_zone*]
|
||||
# (optional) Default compute node availability zone.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*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 undef
|
||||
#
|
||||
class nova::compute (
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
|
@ -141,18 +143,33 @@ class nova::compute (
|
|||
$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',
|
||||
$heal_instance_info_cache_interval = '60',
|
||||
$pci_passthrough = undef,
|
||||
$config_drive_format = undef,
|
||||
$allow_resize_to_same_host = false,
|
||||
# DEPRECATED PARAMETERS
|
||||
$default_availability_zone = undef,
|
||||
$default_schedule_zone = undef,
|
||||
$internal_service_availability_zone = undef,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
if $default_availability_zone {
|
||||
warning('The default_availability_zone parameter is deprecated and will be removed in a future release. Use default_availability_zone parameter of nova class instead.')
|
||||
}
|
||||
|
||||
if $default_schedule_zone {
|
||||
warning('The default_schedule_zone parameter is deprecated and will be removed in a future release. Use default_schedule_zone parameter of nova class instead.')
|
||||
}
|
||||
|
||||
if $internal_service_availability_zone {
|
||||
warning('The internal_service_availability_zone parameter is deprecated and will be removed in a future release. Use internal_service_availability_zone parameter of nova class instead.')
|
||||
}
|
||||
|
||||
include ::nova::availability_zone
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory;
|
||||
'DEFAULT/compute_manager': value => $compute_manager;
|
||||
|
@ -232,17 +249,6 @@ class nova::compute (
|
|||
'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;
|
||||
}
|
||||
}
|
||||
|
||||
if ($pci_passthrough) {
|
||||
nova_config {
|
||||
'DEFAULT/pci_passthrough_whitelist': value => check_array_of_hash($pci_passthrough);
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nova::availability_zone' do
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples 'nova::availability_zone' do
|
||||
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_nova_config('DEFAULT/default_availability_zone').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/default_schedule_zone').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
let :params do
|
||||
{ :default_availability_zone => 'az1',
|
||||
:default_schedule_zone => 'az2',
|
||||
:internal_service_availability_zone => 'az_int1',
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('DEFAULT/default_availability_zone').with_value('az1') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/default_schedule_zone').with_value('az2') }
|
||||
it { is_expected.to contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('az_int1') }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => 'jessie',
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova::availability_zone'
|
||||
|
||||
end
|
||||
|
||||
context 'on Redhat platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemrelease => '7.1',
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova::availability_zone'
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -36,8 +36,9 @@ describe 'nova::compute' do
|
|||
it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with(:value => true) }
|
||||
|
||||
it 'configures availability zones' do
|
||||
is_expected.to contain_nova_config('DEFAULT/default_availability_zone').with_value('nova')
|
||||
is_expected.to contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('internal')
|
||||
is_expected.to contain_nova_config('DEFAULT/default_availability_zone').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('DEFAULT/default_schedule_zone').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_nova_config('DEFAULT/internal_service_availability_zone').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('60') }
|
||||
|
|
Loading…
Reference in New Issue