From 8c2f57b685451fd9149f10c65dabfb05985623f4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 12 Jan 2021 14:03:09 +0900 Subject: [PATCH] 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 --- manifests/compute.pp | 20 +++++++++++ manifests/init.pp | 34 ++++++++++++------- ...ice_allocate_retries-a12f17bd0121ef7d.yaml | 8 +++++ spec/classes/nova_compute_spec.rb | 6 ++++ spec/classes/nova_init_spec.rb | 11 ------ 5 files changed, 55 insertions(+), 24 deletions(-) create mode 100644 releasenotes/notes/block_device_allocate_retries-a12f17bd0121ef7d.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index c3749ad64..c7208bd38 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -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) { diff --git a/manifests/init.pp b/manifests/init.pp index 92d3efc6d..8680a6bbc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 } diff --git a/releasenotes/notes/block_device_allocate_retries-a12f17bd0121ef7d.yaml b/releasenotes/notes/block_device_allocate_retries-a12f17bd0121ef7d.yaml new file mode 100644 index 000000000..afc4dfd9b --- /dev/null +++ b/releasenotes/notes/block_device_allocate_retries-a12f17bd0121ef7d.yaml @@ -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`` diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index 4f8d61622..6fe85590d 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -71,6 +71,8 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('') } it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value('') } 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') diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 688ba1acb..13b62f84a 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -65,10 +65,6 @@ describe 'nova' do is_expected.to contain_nova_config('DEFAULT/dhcp_domain').with_value('') end - it 'configures block_device_allocate params' do - is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries').with_value('') - is_expected.to contain_nova_config('DEFAULT/block_device_allocate_retries_interval').with_value('') - 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