From cdec92f3e8de6094a9871daa47ec1c6681fc02ad Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 4 May 2021 21:35:17 +0900 Subject: [PATCH] Clean up deprecated parameters of nova::compute::libvirt Change-Id: I0ec7242dc1ade27ddf72426e4a89a49ab4d6c9de --- manifests/compute/libvirt.pp | 231 ++---------------- ...nova-compute-libvirt-d109949308bb292d.yaml | 17 ++ spec/classes/nova_compute_libvirt_spec.rb | 16 -- 3 files changed, 43 insertions(+), 221 deletions(-) create mode 100644 releasenotes/notes/cleanup-nova-compute-libvirt-d109949308bb292d.yaml diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 0efd1134a..3ba1c9023 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -210,74 +210,6 @@ # based on the reported kernel major version will be used. # Defaults to $::os_service_default # -# DEPRECATED PARAMETERS -# -# [*libvirt_virt_type*] -# (optional) Libvirt domain type. Options are: kvm, lxc, qemu, paralells -# Defaults to undef -# -# [*libvirt_cpu_mode*] -# (optional) The libvirt CPU mode to configure. Possible values -# include custom, host-model, none, host-passthrough. -# Defaults to 'host-model' if libvirt_virt_type is set to kvm, -# Defaults to undef -# -# [*libvirt_cpu_model*] -# (optional) The named libvirt CPU model (see names listed in -# /usr/share/libvirt/cpu_map.xml). Only has effect if -# cpu_mode="custom" and virt_type="kvm|qemu". -# Defaults to undef -# -# [*libvirt_cpu_model_extra_flags*] -# (optional) This allows specifying granular CPU feature flags when -# specifying CPU models. Only has effect if cpu_mode is not set -# to 'none'. -# Defaults to undef -# -# [*libvirt_snapshot_image_format*] -# (optional) Format to save snapshots to. Some filesystems -# have a preference and only operate on raw or qcow2 -# Defaults to undef -# -# [*libvirt_disk_cachemodes*] -# (optional) A list of cachemodes for different disk types, e.g. -# ["file=directsync", "block=none"] -# If an empty list is specified, the disk_cachemodes directive -# will be removed from nova.conf completely. -# Defaults to undef -# -# [*libvirt_hw_disk_discard*] -# (optional) Discard option for nova managed disks. Need Libvirt(1.0.6) -# Qemu1.5 (raw format) Qemu1.6(qcow2 format). -# Defaults to undef -# -# [*libvirt_hw_machine_type*] -# (optional) Option to specify a default machine type per host architecture. -# Defaults to undef -# -# [*libvirt_inject_password*] -# (optional) Inject the admin password at boot time, without an agent. -# Defaults to undef -# -# [*libvirt_inject_key*] -# (optional) Inject the ssh public key at boot time. -# Defaults to undef -# -# [*libvirt_inject_partition*] -# (optional) The partition to inject to : -2 => disable, -1 => inspect -# (libguestfs only), 0 => not partitioned, >0 => partition -# number (integer value) -# Defaults to -2 -# Defaults to undef -# -# [*libvirt_enabled_perf_events*] -# (optional) This is a performance event list which could be used as monitor. -# A string list. For example: ``enabled_perf_events = cmt, mbml, mbmt`` -# The supported events list can be found in -# https://libvirt.org/html/libvirt-libvirt-domain.html , -# which you may need to search key words ``VIR_PERF_PARAM_*`` -# Defaults to undef -# class nova::compute::libvirt ( $ensure_package = 'present', $virt_type = 'kvm', @@ -318,115 +250,14 @@ class nova::compute::libvirt ( $tls_priority = undef, $ovs_timeout = undef, $max_queues = $::os_service_default, - # DEPRECATED PARAMETERS - $libvirt_virt_type = undef, - $libvirt_cpu_mode = undef, - $libvirt_cpu_model = undef, - $libvirt_cpu_model_extra_flags = undef, - $libvirt_snapshot_image_format = undef, - $libvirt_disk_cachemodes = undef, - $libvirt_hw_disk_discard = undef, - $libvirt_hw_machine_type = undef, - $libvirt_inject_password = undef, - $libvirt_inject_key = undef, - $libvirt_inject_partition = undef, - $libvirt_enabled_perf_events = undef, ) inherits nova::params { include nova::deps include nova::params - if $libvirt_virt_type != undef { - warning('The libvirt_virt_type parameter was deprecated and will be removed \ -in a future release. Use the virt_type parameter instead') - $virt_type_real = $libvirt_virt_type - } else { - $virt_type_real = $virt_type - } - - if $libvirt_cpu_mode != undef { - warning('The libvirt_cpu_mode parameter was deprecated and will be removed \ -in a future release. Use the cpu_mode parameter instead') - $cpu_mode_real = $libvirt_cpu_mode - } else { - $cpu_mode_real = $cpu_mode - } - - if $libvirt_cpu_model_extra_flags != undef { - warning('The libvirt_cpu_model_extra_flags parameter was deprecated and will be removed \ -in a future release. Use the cpu_model_extra_flags parameter instead') - $cpu_model_extra_flags_real = $libvirt_cpu_model_extra_flags - } else { - $cpu_model_extra_flags_real = $cpu_model_extra_flags - } - - if $libvirt_snapshot_image_format != undef { - warning('The libvirt_snapshot_image_format parameter was deprecated and will be removed \ -in a future release. Use the snapshot_image_format parameter instead') - $snapshot_image_format_real = $libvirt_snapshot_image_format - } else { - $snapshot_image_format_real = $snapshot_image_format - } - - if $libvirt_disk_cachemodes != undef { - warning('The libvirt_disk_cachemodes parameter was deprecated and will be removed \ -in a future release. Use the disk_cachemodes parameter instead') - $disk_cachemodes_real = $libvirt_disk_cachemodes - } else { - $disk_cachemodes_real = $disk_cachemodes - } - - if $libvirt_hw_disk_discard != undef { - warning('The libvirt_hw_disk_discard parameter was deprecated and will be removed \ -in a future release. Use the hw_disk_discard parameter instead') - $hw_disk_discard_real = $libvirt_hw_disk_discard - } else { - $hw_disk_discard_real = $hw_disk_discard - } - - if $libvirt_hw_machine_type != undef { - warning('The libvirt_hw_machine_type parameter was deprecated and will be removed \ -in a future release. Use the hw_machine_type parameter instead') - $hw_machine_type_real = $libvirt_hw_machine_type - } else { - $hw_machine_type_real = $hw_machine_type - } - - if $libvirt_inject_password != undef { - warning('The libvirt_inject_password parameter was deprecated and will be removed \ -in a future release. Use the inject_password parameter instead') - $inject_password_real = $libvirt_inject_password - } else { - $inject_password_real = $inject_password - } - - if $libvirt_inject_key != undef { - warning('The libvirt_inject_key parameter was deprecated and will be removed \ -in a future release. Use the inject_key parameter instead') - $inject_key_real = $libvirt_inject_key - } else { - $inject_key_real = $inject_key - } - - if $libvirt_inject_partition != undef { - warning('The libvirt_inject_partition parameter was deprecated and will be removed \ -in a future release. Use the inject_partition parameter instead') - $inject_partition_real = $libvirt_inject_partition - } else { - $inject_partition_real = $inject_partition - } - - if $libvirt_enabled_perf_events != undef { - warning('The libvirt_enabled_perf_events parameter was deprecated and will be removed \ -in a future release. Use the enabled_perf_events parameter instead') - $enabled_perf_events_real = $libvirt_enabled_perf_events - } else { - $enabled_perf_events_real = $enabled_perf_events - } - # cpu_mode has different defaults depending on hypervisor. - if !$cpu_mode_real { - case $virt_type_real { + if !$cpu_mode { + case $virt_type { 'kvm': { $cpu_mode_default = 'host-model' } @@ -435,11 +266,11 @@ in a future release. Use the enabled_perf_events parameter instead') } } } else { - $cpu_mode_default = $cpu_mode_real + $cpu_mode_default = $cpu_mode } if($::osfamily == 'Debian') { - package { "nova-compute-${virt_type_real}": + package { "nova-compute-${virt_type}": ensure => $ensure_package, tag => ['openstack', 'nova-package'], } @@ -515,7 +346,7 @@ in a future release. Use the enabled_perf_events parameter instead') libvirt_service_name => $libvirt_service_name, virtlock_service_name => $virtlock_service_name, virtlog_service_name => $virtlog_service_name, - libvirt_virt_type => $virt_type_real, + libvirt_virt_type => $virt_type, } } @@ -549,16 +380,16 @@ in a future release. Use the enabled_perf_events parameter instead') 'DEFAULT/compute_driver': value => $compute_driver; 'DEFAULT/preallocate_images': value => $preallocate_images; 'vnc/server_listen': value => $vncserver_listen; - 'libvirt/virt_type': value => $virt_type_real; + 'libvirt/virt_type': value => $virt_type; 'libvirt/cpu_mode': value => $cpu_mode_default; - 'libvirt/snapshot_image_format': value => $snapshot_image_format_real; + 'libvirt/snapshot_image_format': value => $snapshot_image_format; 'libvirt/snapshots_directory': value => $snapshots_directory; - 'libvirt/inject_password': value => $inject_password_real; - 'libvirt/inject_key': value => $inject_key_real; - 'libvirt/inject_partition': value => $inject_partition_real; - 'libvirt/hw_disk_discard': value => $hw_disk_discard_real; - 'libvirt/hw_machine_type': value => $hw_machine_type_real; - 'libvirt/enabled_perf_events': value => join(any2array($enabled_perf_events_real), ','); + 'libvirt/inject_password': value => $inject_password; + 'libvirt/inject_key': value => $inject_key; + 'libvirt/inject_partition': value => $inject_partition; + 'libvirt/hw_disk_discard': value => $hw_disk_discard; + 'libvirt/hw_machine_type': value => $hw_machine_type; + 'libvirt/enabled_perf_events': value => join(any2array($enabled_perf_events), ','); 'libvirt/rx_queue_size': value => $rx_queue_size; 'libvirt/tx_queue_size': value => $tx_queue_size; 'libvirt/file_backed_memory': value => $file_backed_memory; @@ -573,52 +404,42 @@ in a future release. Use the enabled_perf_events parameter instead') 'libvirt/max_queues': value => $max_queues; } - if $libvirt_cpu_model != undef { - warning('The libvirt_cpu_model parameter was deprecated an will be removed \ -in a future release. Use the cpu_models parameter instead') - validate_legacy(String, 'validate_string', $libvirt_cpu_model) - $cpu_models_real = [$libvirt_cpu_model] - } else { - validate_legacy(Array, 'validate_array', $cpu_models) - $cpu_models_real = $cpu_models - } - + validate_legacy(Array, 'validate_array', $cpu_models) # cpu_model param is only valid if cpu_mode=custom # otherwise it should be commented out if $cpu_mode_default == 'custom' { - if empty($cpu_models_real){ - $cpu_models_value = $::os_service_default + if empty($cpu_models){ + $cpu_models_real = $::os_service_default } else { - $cpu_models_value = join($cpu_models_real, ',') + $cpu_models_real = join($cpu_models, ',') } } else { - if !empty($cpu_models_real) { + if !empty($cpu_models) { warning('$cpu_models requires that $cpu_mode => "custom" and will be ignored') } - $cpu_models_value = $::os_service_default + $cpu_models_real = $::os_service_default } nova_config { - 'libvirt/cpu_model' : ensure => absent; - 'libvirt/cpu_models': value => $cpu_models_value; + 'libvirt/cpu_models': value => $cpu_models_real; } - if $cpu_mode_default != 'none' and $cpu_model_extra_flags_real { - validate_legacy(String, 'validate_string', $cpu_model_extra_flags_real) + if $cpu_mode_default != 'none' and $cpu_model_extra_flags { + validate_legacy(String, 'validate_string', $cpu_model_extra_flags) nova_config { - 'libvirt/cpu_model_extra_flags': value => $cpu_model_extra_flags_real; + 'libvirt/cpu_model_extra_flags': value => $cpu_model_extra_flags; } } else { nova_config { 'libvirt/cpu_model_extra_flags': ensure => absent; } - if $cpu_model_extra_flags_real { + if $cpu_model_extra_flags { warning('$cpu_model_extra_flags requires that $cpu_mode is not set to "none" and will be ignored') } } - if size($disk_cachemodes_real) > 0 { + if size($disk_cachemodes) > 0 { nova_config { - 'libvirt/disk_cachemodes': value => join($disk_cachemodes_real, ','); + 'libvirt/disk_cachemodes': value => join($disk_cachemodes, ','); } } else { nova_config { diff --git a/releasenotes/notes/cleanup-nova-compute-libvirt-d109949308bb292d.yaml b/releasenotes/notes/cleanup-nova-compute-libvirt-d109949308bb292d.yaml new file mode 100644 index 000000000..529eea348 --- /dev/null +++ b/releasenotes/notes/cleanup-nova-compute-libvirt-d109949308bb292d.yaml @@ -0,0 +1,17 @@ +--- +upgrade: + - | + The following deprecated parameters have been removed from + the ``nova::compute::libvirt`` class. + + - ``libvirt_virt_type`` + - ``libvirt_cpu_mode`` + - ``libvirt_cpu_model`` + - ``libvirt_cpu_model_extra_flags`` + - ``libvirt_snapshot_image_format`` + - ``libvirt_hw_dis_discard`` + - ``libvirt_hw_machine_type`` + - ``libvirt_hw_inject_password`` + - ``libvirt_hw_inject_key`` + - ``libvirt_hw_inject_partition`` + - ``libvirt_enabled_perf_events`` diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 97687408a..4e22d7f8c 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -50,7 +50,6 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('kvm')} it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-model')} it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('')} - it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')} it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_ensure('absent')} it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('')} it { is_expected.to contain_nova_config('libvirt/snapshots_directory').with_value('')} @@ -123,7 +122,6 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('qemu')} it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')} it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('')} - it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')} it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')} it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('raw')} it { is_expected.to contain_nova_config('libvirt/snapshots_directory').with_value('/var/lib/nova/snapshots')} @@ -178,20 +176,6 @@ describe 'nova::compute::libvirt' do it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('custom')} it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('kvm64,qemu64')} - it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')} - it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')} - end - - describe 'with custom cpu_mode with deprecated libvirt_cpu_model' do - let :params do - { :cpu_mode => 'custom', - :libvirt_cpu_model => 'kvm64', - :cpu_model_extra_flags => 'pcid' } - end - - it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('custom')} - it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('kvm64')} - it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')} it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')} end