Files
puppet-neutron/manifests/agents/ml2/macvtap.pp
Takashi Kajinami b3a382f738 Validate ensure parameter for package resources
The minimum version of puppetlabs-stdlib has been bumped globally, so
now we can use the common type definition.

Change-Id: Ide3c9d927c25721001295faa105835928a95cf9d
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-09-23 21:27:01 +09:00

86 lines
2.4 KiB
Puppet

# == Class: neutron::agents::ml2::macvtap
#
# Setups Macvtap Neutron agent for ML2 plugin.
#
# === Parameters
#
# [*package_ensure*]
# (optional) Package ensure state.
# Defaults to 'present'.
#
# [*enabled*]
# (required) Whether or not to enable the agent.
# Defaults to true.
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*polling_interval*]
# (optional) The number of seconds the agent will wait between
# polling for local device changes.
# Defaults to $facts['os_service_default'].
#
# [*physical_interface_mappings*]
# (optional) List of <physical_network>:<physical_interface>
# tuples mapping physical network names to agent's node-specific physical
# network interfaces. Defaults to empty list.
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the macvtap config.
# Defaults to false.
#
class neutron::agents::ml2::macvtap (
Stdlib::Ensure::Package $package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true,
$polling_interval = $facts['os_service_default'],
Array $physical_interface_mappings = [],
Boolean $purge_config = false,
) {
include neutron::deps
include neutron::params
resources { 'neutron_agent_macvtap':
purge => $purge_config,
}
neutron_agent_macvtap {
'agent/polling_interval': value => $polling_interval;
# NOTE(tkajinam): macvtap supports only noop firewall driver.
'securitygroup/firewall_driver': value => 'noop';
}
if !empty($physical_interface_mappings) {
neutron_agent_macvtap {
'macvtap/physical_interface_mappings': value => join($physical_interface_mappings, ',');
}
} else {
neutron_agent_macvtap {
'macvtap/physical_interface_mappings': ensure => absent;
}
}
package { 'neutron-plugin-macvtap-agent':
ensure => $package_ensure,
name => $neutron::params::macvtap_agent_package,
tag => ['openstack', 'neutron-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
service { 'neutron-plugin-macvtap-agent':
ensure => $service_ensure,
name => $neutron::params::macvtap_agent_service,
enable => $enabled,
tag => 'neutron-service',
}
Neutron_agent_macvtap<||> ~> Service['neutron-plugin-macvtap-agent']
}
}