Add support for more image related options

Change-Id: I4fe8e0adcfbb0c3668d04917364ec0349324b75b
This commit is contained in:
Rocky 2020-10-19 10:28:30 +11:00 committed by Takashi Kajinami
parent 2b19fa45a2
commit 558624bfec
3 changed files with 30 additions and 6 deletions

View File

@ -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 <os_type>=<mkfs command>
# 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'],

View File

@ -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.

View File

@ -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('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/reboot_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/instance_build_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/rescue_timeout').with_value('<SERVICE DEFAULT>') }
@ -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') }