replace validate_legacy with proper data types

the validate_legacy function is marked for deprecation in
v9.0.0 from puppetlabs-stdlib.

Change-Id: I7a66cba32f00851e0c93b8ef6e5a620fb474f111
This commit is contained in:
Takashi Kajinami 2023-06-21 14:10:52 +09:00
parent bcadab2490
commit f0cb20a86a
28 changed files with 160 additions and 279 deletions

View File

@ -161,8 +161,8 @@
# Defaults to undef # Defaults to undef
# #
class nova::api( class nova::api(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$api_paste_config = 'api-paste.ini', $api_paste_config = 'api-paste.ini',
$ensure_package = 'present', $ensure_package = 'present',
$api_bind_address = $facts['os_service_default'], $api_bind_address = $facts['os_service_default'],
@ -172,9 +172,9 @@ class nova::api(
$enabled_apis = ['osapi_compute', 'metadata'], $enabled_apis = ['osapi_compute', 'metadata'],
$osapi_compute_workers = $facts['os_workers'], $osapi_compute_workers = $facts['os_workers'],
$metadata_workers = $facts['os_workers'], $metadata_workers = $facts['os_workers'],
$sync_db = true, Boolean $sync_db = true,
$sync_db_api = true, Boolean $sync_db_api = true,
$db_online_data_migrations = false, Boolean $db_online_data_migrations = false,
$service_name = $::nova::params::api_service_name, $service_name = $::nova::params::api_service_name,
$metadata_service_name = $::nova::params::api_metadata_service_name, $metadata_service_name = $::nova::params::api_metadata_service_name,
$enable_proxy_headers_parsing = $facts['os_service_default'], $enable_proxy_headers_parsing = $facts['os_service_default'],
@ -193,7 +193,7 @@ class nova::api(
$instance_list_cells_batch_fixed_size = $facts['os_service_default'], $instance_list_cells_batch_fixed_size = $facts['os_service_default'],
$list_records_by_skipping_down_cells = $facts['os_service_default'], $list_records_by_skipping_down_cells = $facts['os_service_default'],
# DEPRECATED PARAMETER # DEPRECATED PARAMETER
$nova_metadata_wsgi_enabled = false, Boolean $nova_metadata_wsgi_enabled = false,
$use_forwarded_for = undef, $use_forwarded_for = undef,
) inherits nova::params { ) inherits nova::params {
@ -204,12 +204,6 @@ class nova::api(
include nova::availability_zone include nova::availability_zone
include nova::pci include nova::pci
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $sync_db)
validate_legacy(Boolean, 'validate_bool', $sync_db_api)
validate_legacy(Boolean, 'validate_bool', $db_online_data_migrations)
if !$nova_metadata_wsgi_enabled { if !$nova_metadata_wsgi_enabled {
warning('Running nova metadata api via evenlet is deprecated and will be removed in Stein release.') warning('Running nova metadata api via evenlet is deprecated and will be removed in Stein release.')
} }

View File

@ -254,18 +254,18 @@
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
class nova::compute ( class nova::compute (
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$ensure_package = 'present', $ensure_package = 'present',
$vnc_enabled = true, Boolean $vnc_enabled = true,
$spice_enabled = false, Boolean $spice_enabled = false,
$vncserver_proxyclient_address = '127.0.0.1', $vncserver_proxyclient_address = '127.0.0.1',
$vncproxy_host = false, $vncproxy_host = false,
$vncproxy_protocol = 'http', $vncproxy_protocol = 'http',
$vncproxy_port = '6080', $vncproxy_port = '6080',
$vncproxy_path = '/vnc_auto.html', $vncproxy_path = '/vnc_auto.html',
$force_config_drive = false, Boolean $force_config_drive = false,
$instance_usage_audit = false, Boolean $instance_usage_audit = false,
$instance_usage_audit_period = $facts['os_service_default'], $instance_usage_audit_period = $facts['os_service_default'],
$mkisofs_cmd = $facts['os_service_default'], $mkisofs_cmd = $facts['os_service_default'],
$use_cow_images = $facts['os_service_default'], $use_cow_images = $facts['os_service_default'],
@ -290,7 +290,7 @@ class nova::compute (
$sync_power_state_interval = $facts['os_service_default'], $sync_power_state_interval = $facts['os_service_default'],
$consecutive_build_service_disable_threshold = $facts['os_service_default'], $consecutive_build_service_disable_threshold = $facts['os_service_default'],
$reserved_huge_pages = $facts['os_service_default'], $reserved_huge_pages = $facts['os_service_default'],
$neutron_physnets_numa_nodes_mapping = {}, Hash $neutron_physnets_numa_nodes_mapping = {},
$neutron_tunnel_numa_nodes = [], $neutron_tunnel_numa_nodes = [],
$live_migration_wait_for_vif_plug = $facts['os_service_default'], $live_migration_wait_for_vif_plug = $facts['os_service_default'],
$max_disk_devices_to_attach = $facts['os_service_default'], $max_disk_devices_to_attach = $facts['os_service_default'],
@ -308,13 +308,6 @@ class nova::compute (
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $vnc_enabled)
validate_legacy(Boolean, 'validate_bool', $force_config_drive)
validate_legacy(Boolean, 'validate_bool', $instance_usage_audit)
$image_type_exclude_list_real = pick(join(any2array($image_type_exclude_list), ','), $facts['os_service_default']) $image_type_exclude_list_real = pick(join(any2array($image_type_exclude_list), ','), $facts['os_service_default'])
include nova::policy include nova::policy
@ -333,7 +326,6 @@ class nova::compute (
} }
if !empty($neutron_physnets_numa_nodes_mapping) { if !empty($neutron_physnets_numa_nodes_mapping) {
validate_legacy(Hash, 'validate_hash', $neutron_physnets_numa_nodes_mapping)
$neutron_physnets_real = keys($neutron_physnets_numa_nodes_mapping) $neutron_physnets_real = keys($neutron_physnets_numa_nodes_mapping)
nova_config { nova_config {
'neutron/physnets': value => join(any2array($neutron_physnets_real), ','); 'neutron/physnets': value => join(any2array($neutron_physnets_real), ',');

View File

@ -233,9 +233,9 @@ class nova::compute::libvirt (
$ensure_package = 'present', $ensure_package = 'present',
$virt_type = 'kvm', $virt_type = 'kvm',
$vncserver_listen = '127.0.0.1', $vncserver_listen = '127.0.0.1',
$migration_support = false, Boolean $migration_support = false,
$cpu_mode = false, $cpu_mode = false,
$cpu_models = [], Array[String[1]] $cpu_models = [],
$cpu_model_extra_flags = undef, $cpu_model_extra_flags = undef,
$cpu_power_management = $facts['os_service_default'], $cpu_power_management = $facts['os_service_default'],
$cpu_power_management_strategy = $facts['os_service_default'], $cpu_power_management_strategy = $facts['os_service_default'],
@ -258,7 +258,7 @@ class nova::compute::libvirt (
$virtlog_service_name = $::nova::params::virtlog_service_name, $virtlog_service_name = $::nova::params::virtlog_service_name,
$compute_driver = 'libvirt.LibvirtDriver', $compute_driver = 'libvirt.LibvirtDriver',
$preallocate_images = $facts['os_service_default'], $preallocate_images = $facts['os_service_default'],
$manage_libvirt_services = true, Boolean $manage_libvirt_services = true,
$rx_queue_size = $facts['os_service_default'], $rx_queue_size = $facts['os_service_default'],
$tx_queue_size = $facts['os_service_default'], $tx_queue_size = $facts['os_service_default'],
$file_backed_memory = $facts['os_service_default'], $file_backed_memory = $facts['os_service_default'],
@ -279,9 +279,6 @@ class nova::compute::libvirt (
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $migration_support)
validate_legacy(Boolean, 'validate_bool', $manage_libvirt_services)
# cpu_mode has different defaults depending on hypervisor. # cpu_mode has different defaults depending on hypervisor.
if !$cpu_mode { if !$cpu_mode {
case $virt_type { case $virt_type {
@ -381,7 +378,6 @@ class nova::compute::libvirt (
'libvirt/wait_soft_reboot_seconds': value => $wait_soft_reboot_seconds; 'libvirt/wait_soft_reboot_seconds': value => $wait_soft_reboot_seconds;
} }
validate_legacy(Array, 'validate_array', $cpu_models)
# 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 $cpu_mode_default == 'custom' and !empty($cpu_models){ if $cpu_mode_default == 'custom' and !empty($cpu_models){

View File

@ -53,29 +53,19 @@
# or Puppet catalog compilation will fail with duplicate resources. # or Puppet catalog compilation will fail with duplicate resources.
# #
class nova::compute::libvirt::config ( class nova::compute::libvirt::config (
$libvirtd_config = {}, Hash $libvirtd_config = {},
$virtlogd_config = {}, Hash $virtlogd_config = {},
$virtlockd_config = {}, Hash $virtlockd_config = {},
$virtnodedevd_config = {}, Hash $virtnodedevd_config = {},
$virtproxyd_config = {}, Hash $virtproxyd_config = {},
$virtqemud_config = {}, Hash $virtqemud_config = {},
$virtsecretd_config = {}, Hash $virtsecretd_config = {},
$virtstoraged_config = {}, Hash $virtstoraged_config = {},
$qemu_config = {}, Hash $qemu_config = {},
) { ) {
include nova::deps include nova::deps
validate_legacy(Hash, 'validate_hash', $libvirtd_config)
validate_legacy(Hash, 'validate_hash', $virtlogd_config)
validate_legacy(Hash, 'validate_hash', $virtlockd_config)
validate_legacy(Hash, 'validate_hash', $virtnodedevd_config)
validate_legacy(Hash, 'validate_hash', $virtproxyd_config)
validate_legacy(Hash, 'validate_hash', $virtqemud_config)
validate_legacy(Hash, 'validate_hash', $virtsecretd_config)
validate_legacy(Hash, 'validate_hash', $virtstoraged_config)
validate_legacy(Hash, 'validate_hash', $qemu_config)
create_resources('libvirtd_config', $libvirtd_config) create_resources('libvirtd_config', $libvirtd_config)
create_resources('virtlogd_config', $virtlogd_config) create_resources('virtlogd_config', $virtlogd_config)
create_resources('virtlockd_config', $virtlockd_config) create_resources('virtlockd_config', $virtlockd_config)

View File

@ -9,13 +9,11 @@
# Defaults to true. # Defaults to true.
# #
class nova::compute::libvirt::networks( class nova::compute::libvirt::networks(
$disable_default_network = true, Boolean $disable_default_network = true,
) { ) {
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $disable_default_network)
if $disable_default_network { if $disable_default_network {
exec { 'libvirt-default-net-disable-autostart': exec { 'libvirt-default-net-disable-autostart':
command => 'virsh net-autostart default --disable', command => 'virsh net-autostart default --disable',

View File

@ -51,27 +51,21 @@
# Defaults to ::nova::compute::libvirt::version::default # Defaults to ::nova::compute::libvirt::version::default
# #
class nova::compute::libvirt::qemu( class nova::compute::libvirt::qemu(
$configure_qemu = false, Boolean $configure_qemu = false,
$user = undef, $user = undef,
$group = undef, $group = undef,
$max_files = 1024, $max_files = 1024,
$max_processes = 4096, $max_processes = 4096,
$vnc_tls = false, Boolean $vnc_tls = false,
$vnc_tls_verify = true, Boolean $vnc_tls_verify = true,
$default_tls_verify = true, Boolean $default_tls_verify = true,
$memory_backing_dir = undef, $memory_backing_dir = undef,
$nbd_tls = false, Boolean $nbd_tls = false,
$libvirt_version = $::nova::compute::libvirt::version::default, $libvirt_version = $::nova::compute::libvirt::version::default,
) inherits nova::compute::libvirt::version { ) inherits nova::compute::libvirt::version {
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $configure_qemu)
validate_legacy(Boolean, 'validate_bool', $vnc_tls)
validate_legacy(Boolean, 'validate_bool', $vnc_tls_verify)
validate_legacy(Boolean, 'validate_bool', $default_tls_verify)
validate_legacy(Boolean, 'validate_bool', $nbd_tls)
if versioncmp($libvirt_version, '4.5') < 0 { if versioncmp($libvirt_version, '4.5') < 0 {
fail('libvirt version < 4.5 is no longer supported') fail('libvirt version < 4.5 is no longer supported')
} }

View File

@ -47,19 +47,16 @@
# Defaults to false # Defaults to false
# #
class nova::compute::libvirt_guests ( class nova::compute::libvirt_guests (
$enabled = false, Boolean $enabled = false,
$package_ensure = 'present', $package_ensure = 'present',
$shutdown_timeout = '300', $shutdown_timeout = '300',
$on_boot = 'ignore', $on_boot = 'ignore',
$on_shutdown = 'shutdown', $on_shutdown = 'shutdown',
$manage_service = false, Boolean $manage_service = false,
) { ) {
include nova::params include nova::params
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
Anchor['nova::config::begin'] Anchor['nova::config::begin']
-> File<| tag =='libvirt-guests-file' |> -> File<| tag =='libvirt-guests-file' |>
-> File_line<| tag == 'libvirt-guests-file_line'|> -> File_line<| tag == 'libvirt-guests-file_line'|>

View File

@ -9,12 +9,10 @@
# Defaults to {} # Defaults to {}
# #
class nova::compute::mdev( class nova::compute::mdev(
$mdev_types = {}, Hash $mdev_types = {},
) { ) {
include nova::deps include nova::deps
validate_legacy(Hash, 'validate_hash', $mdev_types)
if !empty($mdev_types) { if !empty($mdev_types) {
nova_config { nova_config {
'devices/enabled_mdev_types': value => join(keys($mdev_types), ',') 'devices/enabled_mdev_types': value => join(keys($mdev_types), ',')

View File

@ -94,8 +94,8 @@ class nova::compute::rbd (
$libvirt_images_rbd_glance_copy_poll_interval = $facts['os_service_default'], $libvirt_images_rbd_glance_copy_poll_interval = $facts['os_service_default'],
$libvirt_images_rbd_glance_copy_timeout = $facts['os_service_default'], $libvirt_images_rbd_glance_copy_timeout = $facts['os_service_default'],
$rbd_keyring = 'client.nova', $rbd_keyring = 'client.nova',
$ephemeral_storage = true, Boolean $ephemeral_storage = true,
$manage_ceph_client = true, Boolean $manage_ceph_client = true,
$ceph_client_ensure = 'present', $ceph_client_ensure = 'present',
$package_ensure = 'present', $package_ensure = 'present',
) { ) {
@ -103,9 +103,6 @@ class nova::compute::rbd (
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $ephemeral_storage)
validate_legacy(Boolean, 'validate_bool', $manage_ceph_client)
if $manage_ceph_client { if $manage_ceph_client {
# Install ceph client libraries # Install ceph client libraries
package { 'ceph-client-package': package { 'ceph-client-package':

View File

@ -34,7 +34,7 @@
# Defaults to '/spice_auto.html' # Defaults to '/spice_auto.html'
# #
class nova::compute::spice( class nova::compute::spice(
$agent_enabled = true, Boolean $agent_enabled = true,
$server_listen = $facts['os_service_default'], $server_listen = $facts['os_service_default'],
$server_proxyclient_address = '127.0.0.1', $server_proxyclient_address = '127.0.0.1',
$proxy_host = false, $proxy_host = false,
@ -45,8 +45,6 @@ class nova::compute::spice(
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $agent_enabled)
if $proxy_host { if $proxy_host {
$html5proxy_base_url = "${proxy_protocol}://${proxy_host}:${proxy_port}${proxy_path}" $html5proxy_base_url = "${proxy_protocol}://${proxy_host}:${proxy_port}${proxy_path}"
nova_config { nova_config {

View File

@ -28,11 +28,11 @@
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
class nova::conductor( class nova::conductor(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$ensure_package = 'present', $ensure_package = 'present',
$workers = $facts['os_workers'], $workers = $facts['os_workers'],
$enable_new_services = $facts['os_service_default'], $enable_new_services = $facts['os_service_default'],
) { ) {
include nova::deps include nova::deps
@ -40,9 +40,6 @@ class nova::conductor(
include nova::params include nova::params
include nova::availability_zone include nova::availability_zone
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
nova::generic_service { 'conductor': nova::generic_service { 'conductor':
enabled => $enabled, enabled => $enabled,
manage_service => $manage_service, manage_service => $manage_service,

View File

@ -34,17 +34,13 @@
# or Puppet catalog compilation will fail with duplicate resources. # or Puppet catalog compilation will fail with duplicate resources.
# #
class nova::config ( class nova::config (
$nova_config = {}, Hash $nova_config = {},
$nova_api_paste_ini = {}, Hash $nova_api_paste_ini = {},
$nova_rootwrap_config = {}, Hash $nova_rootwrap_config = {},
) { ) {
include nova::deps include nova::deps
validate_legacy(Hash, 'validate_hash', $nova_config)
validate_legacy(Hash, 'validate_hash', $nova_api_paste_ini)
validate_legacy(Hash, 'validate_hash', $nova_rootwrap_config)
create_resources('nova_config', $nova_config) create_resources('nova_config', $nova_config)
create_resources('nova_api_paste_ini', $nova_api_paste_ini) create_resources('nova_api_paste_ini', $nova_api_paste_ini)
create_resources('nova_rootwrap_config', $nova_rootwrap_config) create_resources('nova_rootwrap_config', $nova_rootwrap_config)

View File

@ -93,33 +93,27 @@
# Defaults to present. # Defaults to present.
# #
class nova::cron::archive_deleted_rows ( class nova::cron::archive_deleted_rows (
$minute = 1, $minute = 1,
$hour = 0, $hour = 0,
$monthday = '*', $monthday = '*',
$month = '*', $month = '*',
$weekday = '*', $weekday = '*',
$max_rows = '100', $max_rows = '100',
$user = $::nova::params::user, $user = $::nova::params::user,
$destination = '/var/log/nova/nova-rowsflush.log', $destination = '/var/log/nova/nova-rowsflush.log',
$until_complete = false, Boolean $until_complete = false,
$purge = false, Boolean $purge = false,
$age = undef, $age = undef,
$all_cells = false, Boolean $all_cells = false,
$task_log = false, Boolean $task_log = false,
$sleep = undef, $sleep = undef,
$verbose = false, Boolean $verbose = false,
$maxdelay = 0, $maxdelay = 0,
Enum['present', 'absent'] $ensure = 'present', Enum['present', 'absent'] $ensure = 'present',
) inherits nova::params { ) inherits nova::params {
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $until_complete)
validate_legacy(Boolean, 'validate_bool', $purge)
validate_legacy(Boolean, 'validate_bool', $all_cells)
validate_legacy(Boolean, 'validate_bool', $task_log)
validate_legacy(Boolean, 'validate_bool', $verbose)
if $until_complete { if $until_complete {
$until_complete_real = ' --until-complete' $until_complete_real = ' --until-complete'
} }

View File

@ -66,26 +66,23 @@
# Defaults to present. # Defaults to present.
# #
class nova::cron::purge_shadow_tables ( class nova::cron::purge_shadow_tables (
$minute = 0, $minute = 0,
$hour = 5, $hour = 5,
$monthday = '*', $monthday = '*',
$month = '*', $month = '*',
$weekday = '*', $weekday = '*',
$user = $::nova::params::user, $user = $::nova::params::user,
$destination = '/var/log/nova/nova-rowspurge.log', $destination = '/var/log/nova/nova-rowspurge.log',
$age = 14, $age = 14,
$all_cells = false, Boolean $all_cells = false,
$verbose = false, Boolean $verbose = false,
$maxdelay = 0, $maxdelay = 0,
Enum['present', 'absent'] $ensure = 'present', Enum['present', 'absent'] $ensure = 'present',
) inherits nova::params { ) inherits nova::params {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $all_cells)
validate_legacy(Boolean, 'validate_bool', $verbose)
if $verbose { if $verbose {
$verbose_real = ' --verbose' $verbose_real = ' --verbose'
} }

View File

@ -37,20 +37,18 @@
# Defaults to true # Defaults to true
# #
class nova::db::mysql( class nova::db::mysql(
$password, String[1] $password,
$dbname = 'nova', $dbname = 'nova',
$user = 'nova', $user = 'nova',
$host = '127.0.0.1', $host = '127.0.0.1',
$charset = 'utf8', $charset = 'utf8',
$collate = 'utf8_general_ci', $collate = 'utf8_general_ci',
$allowed_hosts = undef, $allowed_hosts = undef,
$setup_cell0 = true, Boolean $setup_cell0 = true,
) { ) {
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $setup_cell0)
::openstacklib::db::mysql { 'nova': ::openstacklib::db::mysql { 'nova':
user => $user, user => $user,
password => $password, password => $password,

View File

@ -30,18 +30,16 @@
# Defaults to true # Defaults to true
# #
class nova::db::postgresql( class nova::db::postgresql(
$password, String[1] $password,
$dbname = 'nova', $dbname = 'nova',
$user = 'nova', $user = 'nova',
$encoding = undef, $encoding = undef,
$privileges = 'ALL', $privileges = 'ALL',
$setup_cell0 = true, Boolean $setup_cell0 = true,
) { ) {
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $setup_cell0)
::openstacklib::db::postgresql { 'nova': ::openstacklib::db::postgresql { 'nova':
password => $password, password => $password,
dbname => $dbname, dbname => $dbname,

View File

@ -22,16 +22,14 @@
# Defaults to 300. # Defaults to 300.
# #
class nova::db::sync_api( class nova::db::sync_api(
$extra_params = undef, $extra_params = undef,
$cellv2_setup = false, Boolean $cellv2_setup = false,
$db_sync_timeout = 300, $db_sync_timeout = 300,
) { ) {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $cellv2_setup)
exec { 'nova-db-sync-api': exec { 'nova-db-sync-api':
command => "/usr/bin/nova-manage ${extra_params} api_db sync", command => "/usr/bin/nova-manage ${extra_params} api_db sync",
user => $::nova::params::user, user => $::nova::params::user,

View File

@ -33,17 +33,14 @@
define nova::generic_service( define nova::generic_service(
$package_name, $package_name,
$service_name, $service_name,
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$ensure_package = 'present' $ensure_package = 'present'
) { ) {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
$nova_title = "nova-${name}" $nova_title = "nova-${name}"
# I need to mark that ths package should be # I need to mark that ths package should be

View File

@ -413,8 +413,8 @@ class nova(
$periodic_interval = '60', $periodic_interval = '60',
$report_interval = '10', $report_interval = '10',
$rootwrap_config = '/etc/nova/rootwrap.conf', $rootwrap_config = '/etc/nova/rootwrap.conf',
$use_ssl = false, Boolean $use_ssl = false,
$enabled_ssl_apis = ['metadata', 'osapi_compute'], Array[String[1]] $enabled_ssl_apis = ['metadata', 'osapi_compute'],
$ca_file = false, $ca_file = false,
$cert_file = false, $cert_file = false,
$key_file = false, $key_file = false,
@ -454,9 +454,6 @@ class nova(
include nova::deps include nova::deps
include nova::workarounds include nova::workarounds
validate_legacy(Boolean, 'validate_bool', $use_ssl)
validate_legacy(Array, 'validate_array', $enabled_ssl_apis)
if empty($enabled_ssl_apis) and $use_ssl { if empty($enabled_ssl_apis) and $use_ssl {
warning('enabled_ssl_apis is empty but use_ssl is set to true') warning('enabled_ssl_apis is empty but use_ssl is set to true')
} }

View File

@ -149,9 +149,9 @@
# Defaults to undef # Defaults to undef
# #
class nova::migration::libvirt( class nova::migration::libvirt(
$manage_service = true, Boolean $manage_service = true,
$transport = undef, Enum['tcp', 'tls', 'ssh'] $transport = 'tcp',
$auth = 'none', Enum['sasl', 'none'] $auth = 'none',
$listen_address = $facts['os_service_default'], $listen_address = $facts['os_service_default'],
$live_migration_inbound_addr = $facts['os_service_default'], $live_migration_inbound_addr = $facts['os_service_default'],
$live_migration_tunnelled = $facts['os_service_default'], $live_migration_tunnelled = $facts['os_service_default'],
@ -163,46 +163,30 @@ class nova::migration::libvirt(
$live_migration_timeout_action = $facts['os_service_default'], $live_migration_timeout_action = $facts['os_service_default'],
$live_migration_permit_post_copy = $facts['os_service_default'], $live_migration_permit_post_copy = $facts['os_service_default'],
$live_migration_permit_auto_converge = $facts['os_service_default'], $live_migration_permit_auto_converge = $facts['os_service_default'],
$override_uuid = false, Boolean $override_uuid = false,
$host_uuid = undef, $host_uuid = undef,
$configure_libvirt = true, Boolean $configure_libvirt = true,
$configure_nova = true, Boolean $configure_nova = true,
$client_user = undef, $client_user = undef,
$client_port = undef, $client_port = undef,
$client_extraparams = {}, $client_extraparams = {},
$ca_file = $facts['os_service_default'], $ca_file = $facts['os_service_default'],
$crl_file = $facts['os_service_default'], $crl_file = $facts['os_service_default'],
$libvirt_version = $::nova::compute::libvirt::version::default, $libvirt_version = $::nova::compute::libvirt::version::default,
$modular_libvirt = undef, Optional[Boolean] $modular_libvirt = undef,
) inherits nova::compute::libvirt::version { ) inherits nova::compute::libvirt::version {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $override_uuid)
validate_legacy(Boolean, 'validate_bool', $configure_libvirt)
validate_legacy(Boolean, 'validate_bool', $configure_nova)
if $transport {
$transport_real = $transport
} else {
$transport_real = 'tcp'
}
$modular_libvirt_real = pick($modular_libvirt, $::nova::params::modular_libvirt) $modular_libvirt_real = pick($modular_libvirt, $::nova::params::modular_libvirt)
if $modular_libvirt_real and !$::nova::params::modular_libvirt_support { if $modular_libvirt_real and !$::nova::params::modular_libvirt_support {
fail('Modular libvirt daemons are not supported in this distribution') fail('Modular libvirt daemons are not supported in this distribution')
} }
validate_legacy(Enum['tcp', 'tls', 'ssh'], 'validate_re', $transport_real,
[['^tcp$', '^tls$', '^ssh$'], 'Valid options for transport are tcp, tls, ssh.'])
validate_legacy(Enum['sasl', 'none'], 'validate_re', $auth,
[['^sasl$', '^none$'], 'Valid options for auth are none and sasl.'])
if $configure_nova { if $configure_nova {
if $transport_real == 'ssh' { if $transport == 'ssh' {
if $client_user { if $client_user {
$prefix = "${client_user}@" $prefix = "${client_user}@"
} else { } else {
@ -226,7 +210,7 @@ class nova::migration::libvirt(
$extra_params ='' $extra_params =''
} }
$live_migration_uri = "qemu+${transport_real}://${prefix}%s${postfix}/system${extra_params}" $live_migration_uri = "qemu+${transport}://${prefix}%s${postfix}/system${extra_params}"
nova_config { nova_config {
'libvirt/live_migration_uri': value => $live_migration_uri; 'libvirt/live_migration_uri': value => $live_migration_uri;
@ -284,12 +268,12 @@ class nova::migration::libvirt(
} }
} }
if $transport_real == 'tls' { if $transport == 'tls' {
$auth_tls_real = $auth $auth_tls_real = $auth
$auth_tcp_real = $facts['os_service_default'] $auth_tcp_real = $facts['os_service_default']
$ca_file_real = $ca_file $ca_file_real = $ca_file
$crl_file_real = $crl_file $crl_file_real = $crl_file
} elsif $transport_real == 'tcp' { } elsif $transport == 'tcp' {
$auth_tls_real = $facts['os_service_default'] $auth_tls_real = $facts['os_service_default']
$auth_tcp_real = $auth $auth_tcp_real = $auth
$ca_file_real = $facts['os_service_default'] $ca_file_real = $facts['os_service_default']
@ -320,7 +304,7 @@ class nova::migration::libvirt(
'listen_addr' => { 'ensure' => absent }, 'listen_addr' => { 'ensure' => absent },
}) })
if $transport_real == 'tls' or $transport_real == 'tcp' { if $transport == 'tls' or $transport == 'tcp' {
if versioncmp($libvirt_version, '5.6') < 0 { if versioncmp($libvirt_version, '5.6') < 0 {
fail('libvirt version < 5.6 is no longer supported') fail('libvirt version < 5.6 is no longer supported')
} }
@ -330,7 +314,7 @@ class nova::migration::libvirt(
true => 'virtproxyd', true => 'virtproxyd',
default => 'libvirtd', default => 'libvirtd',
} }
$socket_name = "${proxy_service}-${transport_real}" $socket_name = "${proxy_service}-${transport}"
# This is the dummy resource to trigger exec to stop libvirtd.service. # This is the dummy resource to trigger exec to stop libvirtd.service.
# libvirtd.service should be stopped before socket is started. # libvirtd.service should be stopped before socket is started.
@ -373,7 +357,7 @@ class nova::migration::libvirt(
} else { } else {
$listen_address_real = normalize_ip_for_uri($listen_address) $listen_address_real = normalize_ip_for_uri($listen_address)
$default_listen_port = $transport_real ? { $default_listen_port = $transport ? {
'tls' => 16514, 'tls' => 16514,
default => 16509 default => 16509
} }
@ -387,7 +371,7 @@ class nova::migration::libvirt(
source => "/usr/lib/systemd/system/${socket_name}.socket", source => "/usr/lib/systemd/system/${socket_name}.socket",
replace => false, replace => false,
require => Anchor['nova::install::end'], require => Anchor['nova::install::end'],
} -> file_line { "${proxy_service}-${transport_real}.socket ListenStream": } -> file_line { "${proxy_service}-${transport}.socket ListenStream":
path => "/etc/systemd/system/${socket_name}.socket", path => "/etc/systemd/system/${socket_name}.socket",
line => "ListenStream=${listen_address_real}:${listen_port}", line => "ListenStream=${listen_address_real}:${listen_port}",
match => '^ListenStream=.*', match => '^ListenStream=.*',
@ -403,9 +387,9 @@ class nova::migration::libvirt(
Exec['systemd-damon-reload'] ~> Exec["stop ${proxy_service}.service"] Exec['systemd-damon-reload'] ~> Exec["stop ${proxy_service}.service"]
if $modular_libvirt { if $modular_libvirt {
Service["${proxy_service}-${transport_real}"] -> Service<| title == 'virtproxyd' |> Service["${proxy_service}-${transport}"] -> Service<| title == 'virtproxyd' |>
} else { } else {
Service["${proxy_service}-${transport_real}"] -> Service<| title == 'libvirt' |> Service["${proxy_service}-${transport}"] -> Service<| title == 'libvirt' |>
} }
} }
} }

View File

@ -17,15 +17,13 @@
# Defaults to $facts['os_service_default']. # Defaults to $facts['os_service_default'].
# #
class nova::migration::qemu( class nova::migration::qemu(
$configure_qemu = false, Boolean $configure_qemu = false,
$migration_port_min = $facts['os_service_default'], $migration_port_min = $facts['os_service_default'],
$migration_port_max = $facts['os_service_default'], $migration_port_max = $facts['os_service_default'],
){ ){
include nova::deps include nova::deps
validate_legacy(Boolean, 'validate_bool', $configure_qemu)
Qemu_config<||> ~> Service<| tag == 'libvirt-qemu-service' |> Qemu_config<||> ~> Service<| tag == 'libvirt-qemu-service' |>
if $configure_qemu { if $configure_qemu {

View File

@ -48,7 +48,7 @@
class nova::policy ( class nova::policy (
$enforce_scope = $facts['os_service_default'], $enforce_scope = $facts['os_service_default'],
$enforce_new_defaults = $facts['os_service_default'], $enforce_new_defaults = $facts['os_service_default'],
$policies = {}, Hash $policies = {},
$policy_path = '/etc/nova/policy.yaml', $policy_path = '/etc/nova/policy.yaml',
$policy_default_rule = $facts['os_service_default'], $policy_default_rule = $facts['os_service_default'],
$policy_dirs = $facts['os_service_default'], $policy_dirs = $facts['os_service_default'],
@ -58,8 +58,6 @@ class nova::policy (
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Hash, 'validate_hash', $policies)
$policy_parameters = { $policy_parameters = {
policies => $policies, policies => $policies,
policy_path => $policy_path, policy_path => $policy_path,

View File

@ -76,8 +76,8 @@
# Defaults to undef # Defaults to undef
# #
class nova::scheduler( class nova::scheduler(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$ensure_package = 'present', $ensure_package = 'present',
$workers = $facts['os_workers'], $workers = $facts['os_workers'],
$max_attempts = $facts['os_service_default'], $max_attempts = $facts['os_service_default'],
@ -97,9 +97,6 @@ class nova::scheduler(
include nova::params include nova::params
include nova::availability_zone include nova::availability_zone
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
if $query_placement_for_availability_zone != undef { if $query_placement_for_availability_zone != undef {
warning('The query_placement_for_availability_zone parameter is deprecated.') warning('The query_placement_for_availability_zone parameter is deprecated.')
} }

View File

@ -102,7 +102,7 @@ class nova::scheduler::filter (
$max_instances_per_host = $facts['os_service_default'], $max_instances_per_host = $facts['os_service_default'],
$isolated_images = $facts['os_service_default'], $isolated_images = $facts['os_service_default'],
$isolated_hosts = $facts['os_service_default'], $isolated_hosts = $facts['os_service_default'],
$scheduler_available_filters = ['nova.scheduler.filters.all_filters'], Array[String[1]] $scheduler_available_filters = ['nova.scheduler.filters.all_filters'],
$scheduler_enabled_filters = $facts['os_service_default'], $scheduler_enabled_filters = $facts['os_service_default'],
$scheduler_weight_classes = 'nova.scheduler.weights.all_weighers', $scheduler_weight_classes = 'nova.scheduler.weights.all_weighers',
$track_instance_changes = $facts['os_service_default'], $track_instance_changes = $facts['os_service_default'],
@ -122,27 +122,18 @@ class nova::scheduler::filter (
include nova::deps include nova::deps
# The following values are following this rule: if is_service_default($scheduler_enabled_filters) {
# - default is $facts['os_service_default'] so Puppet won't try to configure it.
# - if set, we'll validate it's an array that is not empty and configure the parameter.
# - Otherwise, fallback to default.
if !is_service_default($scheduler_enabled_filters) and !empty($scheduler_enabled_filters){
validate_legacy(Array, 'validate_array', $scheduler_enabled_filters)
$scheduler_enabled_filters_real = join($scheduler_enabled_filters, ',')
} else {
$scheduler_enabled_filters_real = $facts['os_service_default'] $scheduler_enabled_filters_real = $facts['os_service_default']
} elsif empty($scheduler_enabled_filters){
$scheduler_enabled_filters_real = $facts['os_service_default']
} else {
$scheduler_enabled_filters_real = join(any2array($scheduler_enabled_filters), ',')
} }
if $scheduler_available_filters =~ Array { if empty($scheduler_available_filters) {
if empty($scheduler_available_filters) { $scheduler_available_filters_real = $facts['os_service_default']
$scheduler_available_filters_real = $facts['os_service_default']
} else {
$scheduler_available_filters_real = $scheduler_available_filters
}
} else { } else {
warning('scheduler_available_filters must be an array and will fail in the future') $scheduler_available_filters_real = $scheduler_available_filters
$scheduler_available_filters_real = any2array($scheduler_available_filters)
} }
nova_config { nova_config {

View File

@ -25,19 +25,16 @@
# Defaults to 'present' # Defaults to 'present'
# #
class nova::serialproxy( class nova::serialproxy(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$serialproxy_host = '0.0.0.0', $serialproxy_host = '0.0.0.0',
$serialproxy_port = '6083', $serialproxy_port = '6083',
$ensure_package = 'present' $ensure_package = 'present'
) { ) {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $enabled)
nova_config { nova_config {
'serial_console/serialproxy_port': value => $serialproxy_port; 'serial_console/serialproxy_port': value => $serialproxy_port;
'serial_console/serialproxy_host': value => $serialproxy_host; 'serial_console/serialproxy_host': value => $serialproxy_host;

View File

@ -29,19 +29,16 @@
# Defaults to 'present' # Defaults to 'present'
# #
class nova::spicehtml5proxy( class nova::spicehtml5proxy(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$host = '0.0.0.0', $host = '0.0.0.0',
$port = '6082', $port = '6082',
$ensure_package = 'present' $ensure_package = 'present'
) { ) {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
# Nodes running spicehtml5proxy do *not* need (and in fact, don't care) # Nodes running spicehtml5proxy do *not* need (and in fact, don't care)
# about [spice]/enable to be set. This setting is for compute nodes, # about [spice]/enable to be set. This setting is for compute nodes,
# where we must select VNC or SPICE so that it can be passed on to # where we must select VNC or SPICE so that it can be passed on to

View File

@ -94,15 +94,13 @@ class nova::vendordata(
include nova::deps include nova::deps
if !is_service_default($vendordata_providers) and !empty($vendordata_providers){ if !is_service_default($vendordata_providers) and !empty($vendordata_providers){
validate_legacy(Array, 'validate_array', $vendordata_providers) $vendordata_providers_real = join(any2array($vendordata_providers), ',')
$vendordata_providers_real = join($vendordata_providers, ',')
} else { } else {
$vendordata_providers_real = $facts['os_service_default'] $vendordata_providers_real = $facts['os_service_default']
} }
if !is_service_default($vendordata_dynamic_targets) and !empty($vendordata_dynamic_targets){ if !is_service_default($vendordata_dynamic_targets) and !empty($vendordata_dynamic_targets){
validate_legacy(Array, 'validate_array', $vendordata_dynamic_targets) $vendordata_dynamic_targets_real = join(any2array($vendordata_dynamic_targets), ',')
$vendordata_dynamic_targets_real = join($vendordata_dynamic_targets, ',')
} else { } else {
$vendordata_dynamic_targets_real = $facts['os_service_default'] $vendordata_dynamic_targets_real = $facts['os_service_default']
} }

View File

@ -62,28 +62,23 @@
# Defaults to undef # Defaults to undef
# #
class nova::vncproxy( class nova::vncproxy(
$enabled = true, Boolean $enabled = true,
$manage_service = true, Boolean $manage_service = true,
$vncproxy_protocol = 'http', $vncproxy_protocol = 'http',
$host = '0.0.0.0', $host = '0.0.0.0',
$port = '6080', $port = '6080',
$vncproxy_path = '/vnc_auto.html', $vncproxy_path = '/vnc_auto.html',
$ensure_package = 'present', $ensure_package = 'present',
$allow_noauth = true, Boolean $allow_noauth = true,
$allow_vencrypt = false, Boolean $allow_vencrypt = false,
$vencrypt_key = undef, $vencrypt_key = undef,
$vencrypt_cert = undef, $vencrypt_cert = undef,
$vencrypt_ca = undef, $vencrypt_ca = undef,
) { ) {
include nova::deps include nova::deps
include nova::params include nova::params
validate_legacy(Boolean, 'validate_bool', $enabled)
validate_legacy(Boolean, 'validate_bool', $manage_service)
validate_legacy(Boolean, 'validate_bool', $allow_noauth)
validate_legacy(Boolean, 'validate_bool', $allow_vencrypt)
if (!$allow_noauth and !$allow_vencrypt) { if (!$allow_noauth and !$allow_vencrypt) {
fail('Either allow_noauth or allow_vencrypt must be true') fail('Either allow_noauth or allow_vencrypt must be true')
} }