1
0
forked from ovh/pci-test

feat: Merged stein into merged

This commit is contained in:
syrell 2024-12-01 19:38:41 +01:00
parent 2624c16869
commit 1d6568859f

View File

@ -35,8 +35,8 @@
# #
# [*libvirt_cpu_model_extra_flags*] # [*libvirt_cpu_model_extra_flags*]
# (optional) This allows specifying granular CPU feature flags when # (optional) This allows specifying granular CPU feature flags when
# specifying CPU models. Only valid, if cpu_mode and cpu_model # specifying CPU models. Only has effect if cpu_mode is not set
# attributes are specified and only if cpu_mode="custom". # to 'none'.
# Defaults to undef # Defaults to undef
# #
# [*libvirt_snapshot_image_format*] # [*libvirt_snapshot_image_format*]
@ -137,6 +137,20 @@
# https://libvirt.org/logging.html # https://libvirt.org/logging.html
# Defaults to undef # Defaults to undef
# #
# [*rx_queue_size*]
# (optional) virtio-net rx queue size
# Valid values are 256, 512, 1024
# Defaults to $::os_service_default
#
# [*tx_queue_size*]
# (optional) virtio-net tx queue size
# Valid values are 256, 512, 1024
# Defaults to $::os_service_default
#
# [*file_backed_memory*]
# (optional) Available capacity in MiB for file-backed memory.
# Defaults to $::os_service_default
#
# [*volume_use_multipath*] # [*volume_use_multipath*]
# (optional) Use multipath connection of the # (optional) Use multipath connection of the
# iSCSI or FC volume. Volumes can be connected in the # iSCSI or FC volume. Volumes can be connected in the
@ -169,6 +183,9 @@ class nova::compute::libvirt (
$preallocate_images = $::os_service_default, $preallocate_images = $::os_service_default,
$manage_libvirt_services = true, $manage_libvirt_services = true,
$log_outputs = undef, $log_outputs = undef,
$rx_queue_size = $::os_service_default,
$tx_queue_size = $::os_service_default,
$file_backed_memory = undef,
$volume_use_multipath = $::os_service_default, $volume_use_multipath = $::os_service_default,
) inherits nova::params { ) inherits nova::params {
@ -206,6 +223,14 @@ class nova::compute::libvirt (
} }
} }
unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
}
unless $tx_queue_size == $::os_service_default or $tx_queue_size in [256, 512, 1024] {
fail("Invalid_tx_queue_size parameter: ${tx_queue_size}")
}
# manage_libvirt_services is here for backward compatibility to support # manage_libvirt_services is here for backward compatibility to support
# deployments that do not include nova::compute::libvirt::services # deployments that do not include nova::compute::libvirt::services
# #
@ -241,28 +266,39 @@ class nova::compute::libvirt (
'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard; 'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard;
'libvirt/hw_machine_type': value => $libvirt_hw_machine_type; 'libvirt/hw_machine_type': value => $libvirt_hw_machine_type;
'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ','); 'libvirt/enabled_perf_events': value => join(any2array($libvirt_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;
'libvirt/volume_use_multipath': value => $volume_use_multipath; 'libvirt/volume_use_multipath': value => $volume_use_multipath;
} }
# cpu_model param is only valid if cpu_mode=custom # cpu_model param is only valid if cpu_mode=custom
# otherwise it should be commented out # otherwise it should be commented out
if $libvirt_cpu_mode_real == 'custom' { if $libvirt_cpu_mode_real == 'custom' {
validate_string($libvirt_cpu_model) validate_legacy(String, 'validate_string', $libvirt_cpu_model)
nova_config { nova_config {
'libvirt/cpu_model': value => $libvirt_cpu_model; 'libvirt/cpu_model': value => $libvirt_cpu_model;
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;
} }
} else { } else {
nova_config { nova_config {
'libvirt/cpu_model': ensure => absent; 'libvirt/cpu_model': ensure => absent;
'libvirt/cpu_model_extra_flags': ensure => absent;
} }
if $libvirt_cpu_model { if $libvirt_cpu_model {
warning('$libvirt_cpu_model requires that $libvirt_cpu_mode => "custom" and will be ignored') warning('$libvirt_cpu_model requires that $libvirt_cpu_mode => "custom" and will be ignored')
} }
}
if $libvirt_cpu_mode_real != 'none' {
validate_legacy(String, 'validate_string', $libvirt_cpu_model_extra_flags)
nova_config {
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;
}
} else {
nova_config {
'libvirt/cpu_model_extra_flags': ensure => absent;
}
if $libvirt_cpu_model_extra_flags { if $libvirt_cpu_model_extra_flags {
warning('$libvirt_cpu_model_extra_flags requires that $libvirt_cpu_mode => "custom" and will be ignored') warning('$libvirt_cpu_model_extra_flags requires that $libvirt_cpu_mode is not set to "none" and will be ignored')
} }
} }