From a382ba55f8bd5e0b884e3990614a62df30905924 Mon Sep 17 00:00:00 2001 From: Rocky Date: Mon, 19 Oct 2020 10:28:30 +1100 Subject: [PATCH] Add support for more image related options Change-Id: I4fe8e0adcfbb0c3668d04917364ec0349324b75b (cherry picked from commit 558624bfecadae273c8c61c874598eff5bb40927) --- manifests/compute.pp | 18 ++++++++++++++---- ...image_related_options-37d640d3f76adbbd.yaml | 8 ++++++++ spec/classes/nova_compute_spec.rb | 10 ++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/add_more_image_related_options-37d640d3f76adbbd.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index 9e8edf3d0..88faa4280 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -67,10 +67,19 @@ # Time period must be hour, day, month or year # Defaults to 'month' # +# [*use_cow_images*] +# (optional) Enable use of copy-on-write (cow) images. +# Defaults to $::os_service_default +# # [*force_raw_images*] # (optional) Force backing images to raw format. # Defaults to $::os_service_default # +# [*virt_mkfs*] +# (optional) Name of the mkfs commands for ephemeral device. +# The format is = +# Defaults to $::os_service_default +# # [*reserved_host_memory*] # Reserved host memory # The amount of memory in MB reserved for the host. @@ -276,7 +285,9 @@ class nova::compute ( $virtio_nic = false, $instance_usage_audit = false, $instance_usage_audit_period = 'month', + $use_cow_images = $::os_service_default, $force_raw_images = $::os_service_default, + $virt_mkfs = $::os_service_default, $reserved_host_memory = $::os_service_default, $reserved_host_disk = $::os_service_default, $heal_instance_info_cache_interval = $::os_service_default, @@ -431,6 +442,9 @@ Use the same parameter in nova::api class.') include nova::availability_zone nova_config { + 'DEFAULT/use_cow_images': value => $use_cow_images; + 'DEFAULT/force_raw_images': value => $force_raw_images; + 'DEFAULT/virt_mkfs': value => $virt_mkfs; 'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory; 'DEFAULT/reserved_host_disk_mb': value => $reserved_host_disk; 'DEFAULT/reserved_huge_pages': value => $reserved_huge_pages_real; @@ -509,10 +523,6 @@ Use the same parameter in nova::api class.') } } - nova_config { - 'DEFAULT/force_raw_images': value => $force_raw_images; - } - if is_service_default($config_drive_format) or $config_drive_format == 'iso9660' { ensure_packages($::nova::params::genisoimage_package_name, { tag => ['openstack', 'nova-support-package'], diff --git a/releasenotes/notes/add_more_image_related_options-37d640d3f76adbbd.yaml b/releasenotes/notes/add_more_image_related_options-37d640d3f76adbbd.yaml new file mode 100644 index 000000000..e7641d6d8 --- /dev/null +++ b/releasenotes/notes/add_more_image_related_options-37d640d3f76adbbd.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The new ``nova::compute::use_cow_images`` parameter has been added to + enable use of copy-on-write images. + - | + The new ``nova::compute::virt_mkfs`` parameter has been added to support + to specify the mkfs commands for ephemeral devices. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index da55ecde0..8c6e2e503 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -42,11 +42,13 @@ describe 'nova::compute' do is_expected.to contain_nova_config('spice/enabled').with_value(false) end + it { is_expected.to contain_nova_config('DEFAULT/use_cow_images').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value('') } 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('') } @@ -87,7 +89,9 @@ describe 'nova::compute' do { :enabled => false, :ensure_package => '2012.1-2', :vncproxy_host => '127.0.0.1', + :use_cow_images => false, :force_raw_images => false, + :virt_mkfs => 'windows=mkfs.ntfs --force --fast %(target)s', :reserved_host_memory => '0', :reserved_host_disk => '20', :heal_instance_info_cache_interval => '120', @@ -152,10 +156,12 @@ describe 'nova::compute' do is_expected.to contain_nova_config('spice/enabled').with_value(false) end + it { is_expected.to contain_nova_config('DEFAULT/use_cow_images').with_value(false) } + it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value(false) } + it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('windows=mkfs.ntfs --force --fast %(target)s') } it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('0') } 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') }