From d52161f768b4414c872d642334624d4087a6f268 Mon Sep 17 00:00:00 2001 From: Rocky Date: Mon, 19 Oct 2020 10:03:47 +1100 Subject: [PATCH] Add support for more instance timeout options Change-Id: If64007fee7cac65c1e9c38919bb052c800e42830 (cherry picked from commit 2b19fa45a2c5f0a33a14aa38433f5f2d3e0ca559) --- manifests/compute.pp | 34 +++++++++++++++++++ ...ance_timeout_options-3f7f6f99a921ac71.yaml | 17 ++++++++++ spec/classes/nova_compute_spec.rb | 12 +++++++ 3 files changed, 63 insertions(+) create mode 100644 releasenotes/notes/add_more_instance_timeout_options-3f7f6f99a921ac71.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index c5ae81443..9e8edf3d0 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -85,6 +85,24 @@ # (optional) Config drive format. One of iso9660 (default) or vfat # Defaults to undef # +# [*reboot_timeout*] +# (optioanl) Time interval after which an instance is hard rebooted +# automatically. Setting this option to a time period in seconds will +# automatically hard reboot an instance if it has been stuck in a rebooting +# state longer than N seconds. +# Defaults to $::os_service_default +# +# [*instance_build_timeout*] +# (optional) Maximum time in seconds that an instance can take to build. +# If this timer expires, instance status will be changed to ERROR. +# Enabling this option will make sure an instance will not be stuck +# in BUILD state for a longer period. +# Defaults to $::os_service_default +# +# [*rescue_timeout*] +# (optional) Interval to wait before un-rescuing an instance stuck in RESCUE. +# Defaults to $::os_service_default +# # [*resize_confirm_window*] # (optional) Automatically confirm resizes after N seconds. # Resize functionality will save the existing server before resizing. @@ -96,6 +114,14 @@ # server is in resized state longer than that time. # Defaults to $::os_service_default # +# [*shutdown_timeout*] +# (optional) Total time to wait in seconds for an instance to perform a clean +# shutdown. It determines the overall period (in seconds) a VM is allowed to +# perform a clean shutdown. While performing stop, rescue and shelve, rebuild +# operations, configuring this option gives the VM a chance to perform a +# controlled shutdown before the instance is powered off. +# Defaults to $::os_service_default +# # [*cpu_shared_set*] # (optional) A list or range of host CPU cores to which emulator threads can be # scheduled, if vcpu_pin_set is set, or to which both emulator threads and processes @@ -255,7 +281,11 @@ class nova::compute ( $reserved_host_disk = $::os_service_default, $heal_instance_info_cache_interval = $::os_service_default, $config_drive_format = $::os_service_default, + $reboot_timeout = $::os_service_default, + $instance_build_timeout = $::os_service_default, + $rescue_timeout = $::os_service_default, $resize_confirm_window = $::os_service_default, + $shutdown_timeout = $::os_service_default, $cpu_shared_set = $::os_service_default, $cpu_dedicated_set = $::os_service_default, $resume_guests_state_on_host_boot = $::os_service_default, @@ -405,7 +435,11 @@ Use the same parameter in nova::api class.') 'DEFAULT/reserved_host_disk_mb': value => $reserved_host_disk; 'DEFAULT/reserved_huge_pages': value => $reserved_huge_pages_real; 'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval; + 'DEFAULT/reboot_timeout': value => $reboot_timeout; + 'DEFAULT/instance_build_timeout': value => $instance_build_timeout; + 'DEFAULT/rescue_timeout': value => $rescue_timeout; 'DEFAULT/resize_confirm_window': value => $resize_confirm_window; + 'DEFAULT/shutdown_timeout': value => $shutdown_timeout; 'DEFAULT/resume_guests_state_on_host_boot': value => $resume_guests_state_on_host_boot; 'key_manager/backend': value => $keymgr_backend; 'barbican/auth_endpoint': value => $barbican_auth_endpoint; diff --git a/releasenotes/notes/add_more_instance_timeout_options-3f7f6f99a921ac71.yaml b/releasenotes/notes/add_more_instance_timeout_options-3f7f6f99a921ac71.yaml new file mode 100644 index 000000000..32a0b715b --- /dev/null +++ b/releasenotes/notes/add_more_instance_timeout_options-3f7f6f99a921ac71.yaml @@ -0,0 +1,17 @@ +--- +features: + - | + The new ``nova::compute::reboot_timeout`` parameter has been added to + support to set a time interval after which an instance is hard rebooted + automatically.- | + - | + The new ``nova::compute::instance_build_timeout`` parameter has been + added to support to specify the maximum time for instance to build. + - | + The new ``nova::compute::rescue_timeout`` parameter has been added to + support to set an interval to wait before un-rescuing an instance + stuck in RESCUE. + - | + The new ``nova::compute::shutdown_timeout`` parameter has been added to + support to set a time to wait in seconds for an instance to perform + a clean shutdown. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index 8d9aa6978..da55ecde0 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -47,7 +47,11 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/reboot_timeout').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/instance_build_timeout').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/rescue_timeout').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/shutdown_timeout').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with_value('') } it { is_expected.to contain_nova_config('glance/verify_glance_signatures').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_builds').with_value('') } @@ -88,7 +92,11 @@ describe 'nova::compute' do :reserved_host_disk => '20', :heal_instance_info_cache_interval => '120', :config_drive_format => 'vfat', + :reboot_timeout => '180', + :instance_build_timeout => '300', + :rescue_timeout => '120', :resize_confirm_window => '3', + :shutdown_timeout => '100', :resume_guests_state_on_host_boot => true, :keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager', :barbican_endpoint => 'http://localhost', @@ -148,7 +156,11 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value('20') } it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('120') } it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value(false) } + it { is_expected.to contain_nova_config('DEFAULT/reboot_timeout').with_value('180') } + it { is_expected.to contain_nova_config('DEFAULT/instance_build_timeout').with_value('300') } + it { is_expected.to contain_nova_config('DEFAULT/rescue_timeout').with_value('120') } it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('3') } + it { is_expected.to contain_nova_config('DEFAULT/shutdown_timeout').with_value('100') } it { is_expected.to contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with_value(true) } it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_builds').with_value('15') } it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_live_migrations').with_value('4') }