Migrate parameters about block device allocation

The following parameters are used only by nova-compute. This change
migrates these parameters from the nova class to the nova::compute
class to gather all parameters specific to nova-compute into its own
class.
 - block_device_allocate_retries
 - block_device_allocate_retries_interval

Change-Id: I9648f3c074eff88dc6663b75b7095b01a6da39a3
This commit is contained in:
Takashi Kajinami 2021-01-12 14:03:09 +09:00
parent 7efa708f76
commit 8c2f57b685
5 changed files with 55 additions and 24 deletions

View File

@ -266,6 +266,14 @@
# [*image_type_exclude_list*]
# (optional) List of image formats that should not be advertised as supported
# by the compute service.
#
# [*block_device_allocate_retries*]
# (optional) Number of times to retry block device allocation on failures
# Defaults to $::os_service_default
#
# [*block_device_allocate_retries_interval*]
# (optional) Waiting time interval (seconds) between block device allocation
# retries on failures
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
@ -356,6 +364,8 @@ class nova::compute (
$compute_monitors = $::os_service_default,
$default_ephemeral_format = $::os_service_default,
$image_type_exclude_list = $::os_service_default,
$block_device_allocate_retries = $::os_service_default,
$block_device_allocate_retries_interval = $::os_service_default,
# DEPRECATED PARAMETERS
$neutron_enabled = undef,
$install_bridge_utils = undef,
@ -487,6 +497,13 @@ Use the same parameter in nova::api class.')
include nova::availability_zone
$block_device_allocate_retries_real = pick(
$::nova::block_device_allocate_retries,
$block_device_allocate_retries)
$block_device_allocate_retries_interval_real = pick(
$::nova::block_device_allocate_retries_interval,
$block_device_allocate_retries_interval)
nova_config {
'DEFAULT/use_cow_images': value => $use_cow_images;
'DEFAULT/force_raw_images': value => $force_raw_images;
@ -522,6 +539,9 @@ Use the same parameter in nova::api class.')
'DEFAULT/compute_monitors': value => join(any2array($compute_monitors), ',');
'DEFAULT/default_ephemeral_format': value => $default_ephemeral_format;
'compute/image_type_exclude_list': value => $image_type_exclude_list_real;
'DEFAULT/block_device_allocate_retries': value => $block_device_allocate_retries_real;
'DEFAULT/block_device_allocate_retries_interval':
value => $block_device_allocate_retries_interval_real;
}
if ($vnc_enabled) {

View File

@ -310,15 +310,6 @@
# in the nova config.
# Defaults to false.
#
# [*block_device_allocate_retries*]
# (optional) Number of times to retry block device allocation on failures
# Defaults to $::os_service_default
#
# [*block_device_allocate_retries_interval*]
# (optional) Waiting time interval (seconds) between block device allocation
# retries on failures
# Defaults to $::os_service_default
#
# [*cpu_allocation_ratio*]
# (optional) Virtual CPU to physical CPU allocation ratio which affects all
# CPU filters. This can be set on the scheduler, or can be overridden
@ -427,10 +418,17 @@
# (optional) Number of retries in glance operation
# Defaults to undef.
#
# [*block_device_allocate_retries*]
# (optional) Number of times to retry block device allocation on failures
# Defaults to undef.
#
# [*block_device_allocate_retries_interval*]
# (optional) Waiting time interval (seconds) between block device allocation
# retries on failures
# Defaults to undef.
#
class nova(
$ensure_package = 'present',
$block_device_allocate_retries = $::os_service_default,
$block_device_allocate_retries_interval = $::os_service_default,
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
@ -519,6 +517,8 @@ class nova(
$amqp_allow_insecure_clients = undef,
$glance_endpoint_override = undef,
$glance_num_retries = undef,
$block_device_allocate_retries = undef,
$block_device_allocate_retries_interval = undef,
) inherits nova::params {
include nova::deps
@ -605,6 +605,16 @@ Use nova::glance::endpoint_override instead.')
Use nova::glance::num_retries instead.')
}
if $block_device_allocate_retries != undef {
warning('The block_device_allocate_retries parameter is deprecated. \
Use nova::compute::block_device_allocate_retries instead')
}
if $block_device_allocate_retries_interval != undef {
warning('The block_device_allocate_retries_interval parameter is deprecated. \
Use nova::compute::block_device_allocate_retries_interval instead')
}
if $use_ssl {
if !$cert_file {
fail('The cert_file parameter is required when use_ssl is set to true')
@ -792,8 +802,6 @@ but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.")
'DEFAULT/service_down_time': value => $service_down_time;
'DEFAULT/rootwrap_config': value => $rootwrap_config;
'DEFAULT/report_interval': value => $report_interval;
'DEFAULT/block_device_allocate_retries': value => $block_device_allocate_retries;
'DEFAULT/block_device_allocate_retries_interval': value => $block_device_allocate_retries_interval;
}
oslo::concurrency { 'nova_config': lock_path => $lock_path }

View File

@ -0,0 +1,8 @@
---
deprecations:
- |
The following parameters have been deprecated. Use the same parameters of
the ``nova::compute`` class instead.
- ``nova::block_device_allocate_retries``
- ``nova::block_device_allocate_retries_interval``

View File

@ -71,6 +71,8 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_package('bridge-utils').with(
:ensure => 'present',
@ -131,6 +133,8 @@ describe 'nova::compute' do
:compute_monitors => ['cpu.virt_driver','fake'],
:default_ephemeral_format => 'ext4',
:image_type_exclude_list => ['raw','ami'],
:block_device_allocate_retries => 60,
:block_device_allocate_retries_interval => 3,
}
end
@ -197,6 +201,8 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('cpu.virt_driver,fake') }
it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('ext4') }
it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('raw,ami') }
it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value(60) }
it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value(3) }
it 'configures nova config_drive_format to vfat' do
is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat')

View File

@ -65,10 +65,6 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/dhcp_domain').with_value('<SERVICE DEFAULT>')
end
it 'configures block_device_allocate params' do
is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value('<SERVICE DEFAULT>')
end
end
context 'with overridden parameters' do
@ -104,8 +100,6 @@ describe 'nova' do
:upgrade_level_network => '1.0.0',
:upgrade_level_scheduler => '1.0.0',
:purge_config => false,
:block_device_allocate_retries => '60',
:block_device_allocate_retries_interval => '3',
:my_ip => '192.0.2.1',
:ssl_only => true,
:cert => '/etc/ssl/private/snakeoil.pem',
@ -194,11 +188,6 @@ describe 'nova' do
['ceilometer.compute.nova_notifier', 'nova.openstack.common.notifier.rpc_notifier']
) }
end
it 'configures block_device_allocate params' do
is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value('60')
is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value('3')
end
end
context 'with wrong notify_on_state_change parameter' do