Add neutron DHCP agent resource

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-08-06 14:00:50 +02:00
parent d83e203171
commit 4a9fee81e8
5 changed files with 183 additions and 0 deletions

View File

@ -253,6 +253,13 @@ def setup_resources():
})[0] })[0]
signals.connect(node1, neutron_agents_ovs) signals.connect(node1, neutron_agents_ovs)
# NEUTRON DHCP, L3, metadata agents
neutron_agents_dhcp = vr.create('neutron_agents_dhcp', 'resources/neutron_agents_dhcp_puppet', {
'use_namespaces': False,
})[0]
signals.connect(node1, neutron_agents_dhcp)
# NEUTRON FOR COMPUTE (node2) # NEUTRON FOR COMPUTE (node2)
# Deploy chain neutron -> (plugins) -> ( agents ) # Deploy chain neutron -> (plugins) -> ( agents )
neutron_puppet2 = vr.create('neutron_puppet2', 'resources/neutron_puppet', {})[0] neutron_puppet2 = vr.create('neutron_puppet2', 'resources/neutron_puppet', {})[0]

View File

@ -0,0 +1,58 @@
# Neutron DHCP agent puppet resource
Setups Neutron DHCP agent.
# Parameters
https://github.com/openstack/puppet-neutron/blob/5.1.0/manifests/agents/dhcp.pp
``package_ensure``
(optional) Ensure state for package. Defaults to 'present'.
``debug``
(optional) Show debugging output in log. Defaults to false.
``state_path``
(optional) Where to store dnsmasq state files. This directory must be
writable by the user executing the agent. Defaults to '/var/lib/neutron'.
``resync_interval``
(optional) The DHCP agent will resync its state with Neutron to recover
from any transient notification or rpc errors. The interval is number of
seconds between attempts. Defaults to 30.
``interface_driver``
(optional) Defaults to 'neutron.agent.linux.interface.OVSInterfaceDriver'.
``dhcp_driver``
(optional) Defaults to 'neutron.agent.linux.dhcp.Dnsmasq'.
``root_helper``
(optional) Defaults to 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf'.
Addresses bug: https://bugs.launchpad.net/neutron/+bug/1182616
Note: This can safely be removed once the module only targets the Havana release.
``use_namespaces``
(optional) Allow overlapping IP (Must have kernel build with
CONFIG_NET_NS=y and iproute2 package that supports namespaces).
Defaults to true.
``dnsmasq_config_file``
(optional) Override the default dnsmasq settings with this file.
Defaults to undef
``dhcp_delete_namespaces``
(optional) Delete namespace after removing a dhcp server
Defaults to false.
``enable_isolated_metadata``
(optional) enable metadata support on isolated networks.
Defaults to false.
``enable_metadata_network``
(optional) Allows for serving metadata requests coming from a dedicated metadata
access network whose cidr is 169.254.169.254/16 (or larger prefix), and is
connected to a Neutron router from which the VMs send metadata request.
This option requires enable_isolated_metadata = True
Defaults to false.

View File

@ -0,0 +1,16 @@
class { 'neutron::agents::dhcp':
package_ensure => 'absent',
enabled => false,
}
include neutron::params
package { 'neutron':
ensure => 'absent',
name => $::neutron::params::package_name,
}
# Remove external class dependency
Service <| title == 'neutron-dhcp-service' |> {
require => undef
}

View File

@ -0,0 +1,45 @@
$resource = hiera($::resource_name)
$ip = $resource['input']['ip']['value']
$package_ensure = $resource['input']['package_ensure']['value']
$debug = $resource['input']['debug']['value']
$state_path = $resource['input']['state_path']['value']
$resync_interval = $resource['input']['resync_interval']['value']
$interface_driver = $resource['input']['interface_driver']['value']
$dhcp_driver = $resource['input']['dhcp_driver']['value']
$root_helper = $resource['input']['root_helper']['value']
$use_namespaces = $resource['input']['use_namespaces']['value']
$dnsmasq_config_file = $resource['input']['dnsmasq_config_file']['value']
$dhcp_delete_namespaces = $resource['input']['dhcp_delete_namespaces']['value']
$enable_isolated_metadata = $resource['input']['enable_isolated_metadata']['value']
$enable_metadata_network = $resource['input']['enable_metadata_network']['value']
class { 'neutron::agents::dhcp':
enabled => true,
manage_service => true,
package_ensure => $package_ensure,
debug => $debug,
state_path => $state_path,
resync_interval => $resync_interval,
interface_driver => $interface_driver,
dhcp_driver => $dhcp_driver,
root_helper => $root_helper,
use_namespaces => $use_namespaces,
dnsmasq_config_file => $dnsmasq_config_file,
dhcp_delete_namespaces => $dhcp_delete_namespaces,
enable_isolated_metadata => $enable_isolated_metadata,
enable_metadata_network => $enable_metadata_network,
}
include neutron::params
package { 'neutron':
ensure => $package_ensure,
name => $::neutron::params::package_name,
}
# Remove external class dependency
Service <| title == 'neutron-dhcp-service' |> {
require => undef
}

View File

@ -0,0 +1,57 @@
handler: puppet
id: 'neutron_agents_dhcp_puppet'
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
package_ensure:
schema: str
value: present
debug:
schema: bool
value: false
state_path:
schema: str
value: '/var/lib/neutron'
resync_interval:
schema: int
value: 30
interface_driver:
schema: str
value: 'neutron.agent.linux.interface.OVSInterfaceDriver'
dhcp_driver:
schema: str
value: 'neutron.agent.linux.dhcp.Dnsmasq'
root_helper:
schema: str
value: 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf'
use_namespaces:
schema: bool
value: true
dnsmasq_config_file:
schema: str
value:
dhcp_delete_namespaces:
schema: bool
value: false
enable_isolated_metadata:
schema: bool
value: false
enable_metadata_network:
schema: bool
value: false
git:
schema: {repository: str!, branch: str!}
value: {repository: 'https://github.com/openstack/puppet-neutron', branch: '5.1.0'}
puppet_module: 'neutron'
tags: [resource/neutron, resource/neutron_agents_dhcp]
version: 1.0.0