From fb73d45b03e10e6fed500c3a59b899b91a590783 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Mon, 18 Mar 2024 22:16:02 +0100 Subject: [PATCH] Add nova::compute::flat_injected parameter This adds a parameter to the nova::compute class for the flat_injected configuration option. Change-Id: Idb6b9ce7e21a96e8c63e1c2976e4088a307b1c25 --- manifests/compute.pp | 16 ++++++++++++---- .../compute-flat-injected-f6aafc9e59ab2728.yaml | 5 +++++ spec/classes/nova_compute_spec.rb | 9 +++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/compute-flat-injected-f6aafc9e59ab2728.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index 5777fb729..bc3e1e834 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -54,10 +54,6 @@ # (optional) Whether to force the config drive to be attached to all VMs # Defaults to false # -# [*mkisofs_cmd*] -# (optional) Name or path of the tool used for ISO image creation. -# Defaults to $facts['os_service_default'] -# # [*instance_usage_audit*] # (optional) Generate periodic compute.instance.exists notifications. # Defaults to false @@ -67,6 +63,15 @@ # Time period must be hour, day, month or year with/without offset. # Defaults to $facts['os_service_default'] # +# [*flat_injected*] +# (optional) This option determines whether the network setup information is +# injected into the VM before it is booted. +# Defaults to $facts['os_service_default'] +# +# [*mkisofs_cmd*] +# (optional) Name or path of the tool used for ISO image creation. +# Defaults to $facts['os_service_default'] +# # [*use_cow_images*] # (optional) Enable use of copy-on-write (cow) images. # Defaults to $facts['os_service_default'] @@ -271,6 +276,7 @@ class nova::compute ( Boolean $force_config_drive = false, Boolean $instance_usage_audit = false, $instance_usage_audit_period = $facts['os_service_default'], + $flat_injected = $facts['os_service_default'], $mkisofs_cmd = $facts['os_service_default'], $use_cow_images = $facts['os_service_default'], $force_raw_images = $facts['os_service_default'], @@ -451,6 +457,8 @@ class nova::compute ( } } + nova_config { 'DEFAULT/flat_injected': value => $flat_injected } + nova_config { 'DEFAULT/config_drive_format': value => pick($config_drive_format, $facts['os_service_default']); } diff --git a/releasenotes/notes/compute-flat-injected-f6aafc9e59ab2728.yaml b/releasenotes/notes/compute-flat-injected-f6aafc9e59ab2728.yaml new file mode 100644 index 000000000..14362339b --- /dev/null +++ b/releasenotes/notes/compute-flat-injected-f6aafc9e59ab2728.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added new ``nova::compute::flat_injected`` boolean parameter to configure the + configuration option in Nova with the same name. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index ae8bfa100..23943af04 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -66,6 +66,7 @@ describe 'nova::compute' do 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 contain_nova_config('DEFAULT/flat_injected').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('') } it { is_expected.to_not contain_package('bridge-utils').with( @@ -296,6 +297,14 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/force_config_drive').with_value(true) } end + context 'with flat_injected parameter set to true' do + let :params do + { :flat_injected => true } + end + + it { is_expected.to contain_nova_config('DEFAULT/flat_injected').with_value(true) } + end + context 'while not managing service state' do let :params do {