From f5fd94991b271dd38f336d968b7713453cf3933e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= <mgagne@iweb.com>
Date: Wed, 9 Jul 2014 20:44:07 -0400
Subject: [PATCH] Configure OVS mechanism agent configs in its config file
Configurations for the OVS agent should go in its config file:
/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
Therefore, we should not remove the agent config file and
replace it with a symlink to plugin.ini or ml2_conf.ini.
Those config files are meant to be used by the core plugin itself
in neutron-server, not the agents themselves.
- Remove symlink creation from ovs_neutron_plugin.ini to plugin.ini
- Use neutron_plugin_ovs to configure OVS mechanism agent configs
Change-Id: I53d9b923784587e8a2a934f004a3b054c716daaa
---
manifests/agents/ml2/ovs.pp | 39 ++++++-----------
spec/classes/neutron_agents_ml2_ovs_spec.rb | 66 ++++++++++++-----------------
2 files changed, 40 insertions(+), 65 deletions(-)
diff --git a/manifests/agents/ml2/ovs.pp b/manifests/agents/ml2/ovs.pp
index 34c1ddb..c999880 100644
--- a/manifests/agents/ml2/ovs.pp
+++ b/manifests/agents/ml2/ovs.pp
@@ -107,7 +107,8 @@ class neutron::agents::ml2::ovs (
fail('Local ip for ovs agent must be set when tunneling is enabled')
}
- Neutron_plugin_ml2<||> ~> Service['neutron-ovs-agent-service']
+ Package['neutron-ovs-agent'] -> Neutron_plugin_ovs<||>
+ Neutron_plugin_ovs<||> ~> Service['neutron-ovs-agent-service']
if ($bridge_mappings != []) {
# bridge_mappings are used to describe external networks that are
@@ -125,7 +126,7 @@ class neutron::agents::ml2::ovs (
# Set config for bridges that we're going to create
# The OVS neutron plugin will talk in terms of the networks in the bridge_mappings
$br_map_str = join($bridge_mappings, ',')
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'ovs/bridge_mappings': value => $br_map_str;
}
neutron::plugins::ovs::bridge{ $bridge_mappings:
@@ -136,19 +137,17 @@ class neutron::agents::ml2::ovs (
}
}
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'agent/polling_interval': value => $polling_interval;
'agent/l2_population': value => $l2_population;
'agent/arp_responder': value => $arp_responder;
'ovs/integration_bridge': value => $integration_bridge;
}
- if ($firewall_driver) {
- neutron_plugin_ml2 { 'securitygroup/firewall_driver':
- value => $firewall_driver
- }
+ if $firewall_driver {
+ neutron_plugin_ovs { 'securitygroup/firewall_driver': value => $firewall_driver }
} else {
- neutron_plugin_ml2 { 'securitygroup/firewall_driver': ensure => absent }
+ neutron_plugin_ovs { 'securitygroup/firewall_driver': ensure => absent }
}
vs_bridge { $integration_bridge:
@@ -161,25 +160,25 @@ class neutron::agents::ml2::ovs (
ensure => present,
before => Service['neutron-ovs-agent-service'],
}
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'ovs/enable_tunneling': value => true;
'ovs/tunnel_bridge': value => $tunnel_bridge;
'ovs/local_ip': value => $local_ip;
}
if size($tunnel_types) > 0 {
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'agent/tunnel_types': value => join($tunnel_types, ',');
}
}
if 'vxlan' in $tunnel_types {
validate_vxlan_udp_port($vxlan_udp_port)
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'agent/vxlan_udp_port': value => $vxlan_udp_port;
}
}
} else {
- neutron_plugin_ml2 {
+ neutron_plugin_ovs {
'ovs/enable_tunneling': value => false;
'ovs/tunnel_bridge': ensure => absent;
'ovs/local_ip': ensure => absent;
@@ -188,7 +187,6 @@ class neutron::agents::ml2::ovs (
if $::neutron::params::ovs_agent_package {
- Package['neutron-ovs-agent'] -> Neutron_plugin_ml2<||>
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_agent_package,
@@ -197,21 +195,11 @@ class neutron::agents::ml2::ovs (
# Some platforms (RedHat) do not provide a separate
# neutron plugin ovs agent package. The configuration file for
# the ovs agent is provided by the neutron ovs plugin package.
- Package['neutron-ovs-agent'] -> Neutron_plugin_ml2<||>
- Package['neutron-ovs-agent'] -> Service['ovs-cleanup-service']
-
if ! defined(Package['neutron-ovs-agent']) {
package { 'neutron-ovs-agent':
ensure => $package_ensure,
name => $::neutron::params::ovs_server_package,
- } ->
- # https://bugzilla.redhat.com/show_bug.cgi?id=1087647
- # Causes init script for agent to load the old ovs file
- # instead of the ml2 config file.
- file { '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini':
- ensure => link,
- target => '/etc/neutron/plugin.ini'
- } ~> Service<| title == 'neutron-ovs-agent-service' |>
+ }
}
}
@@ -229,7 +217,8 @@ class neutron::agents::ml2::ovs (
}
if $::neutron::params::ovs_cleanup_service {
- service {'ovs-cleanup-service':
+ Package['neutron-ovs-agent'] -> Service['ovs-cleanup-service']
+ service { 'ovs-cleanup-service':
ensure => $service_ensure,
name => $::neutron::params::ovs_cleanup_service,
enable => $enabled,
diff --git a/spec/classes/neutron_agents_ml2_ovs_spec.rb b/spec/classes/neutron_agents_ml2_ovs_spec.rb
index a4e9f77..26d4812 100644
--- a/spec/classes/neutron_agents_ml2_ovs_spec.rb
+++ b/spec/classes/neutron_agents_ml2_ovs_spec.rb
@@ -33,15 +33,15 @@ describe 'neutron::agents::ml2::ovs' do
it { should contain_class('neutron::params') }
it 'configures ovs_neutron_plugin.ini' do
- should contain_neutron_plugin_ml2('agent/polling_interval').with_value(p[:polling_interval])
- should contain_neutron_plugin_ml2('agent/l2_population').with_value(p[:l2_population])
- should contain_neutron_plugin_ml2('agent/arp_responder').with_value(p[:arp_responder])
- should contain_neutron_plugin_ml2('ovs/integration_bridge').with_value(p[:integration_bridge])
- should contain_neutron_plugin_ml2('securitygroup/firewall_driver').\
+ should contain_neutron_plugin_ovs('agent/polling_interval').with_value(p[:polling_interval])
+ should contain_neutron_plugin_ovs('agent/l2_population').with_value(p[:l2_population])
+ should contain_neutron_plugin_ovs('agent/arp_responder').with_value(p[:arp_responder])
+ should contain_neutron_plugin_ovs('ovs/integration_bridge').with_value(p[:integration_bridge])
+ should contain_neutron_plugin_ovs('securitygroup/firewall_driver').\
with_value(p[:firewall_driver])
- should contain_neutron_plugin_ml2('ovs/enable_tunneling').with_value(false)
- should contain_neutron_plugin_ml2('ovs/tunnel_bridge').with_ensure('absent')
- should contain_neutron_plugin_ml2('ovs/local_ip').with_ensure('absent')
+ should contain_neutron_plugin_ovs('ovs/enable_tunneling').with_value(false)
+ should contain_neutron_plugin_ovs('ovs/tunnel_bridge').with_ensure('absent')
+ should contain_neutron_plugin_ovs('ovs/local_ip').with_ensure('absent')
end
it 'configures vs_bridge' do
@@ -58,18 +58,20 @@ describe 'neutron::agents::ml2::ovs' do
:name => platform_params[:ovs_agent_package],
:ensure => p[:package_ensure]
)
- should contain_package('neutron-ovs-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
+ should contain_package('neutron-ovs-agent').with_before(/Neutron_plugin_ovs\[.+\]/)
else
end
end
- it 'configures neutron ovs agent service' do
- should contain_service('neutron-ovs-agent-service').with(
- :name => platform_params[:ovs_agent_service],
- :enable => true,
- :ensure => 'running',
- :require => 'Class[Neutron]'
- )
+ it 'configures neutron ovs cleanup service (if any)' do
+ if platform_params.has_key?(:ovs_cleanup_service)
+ should contain_service('ovs-cleanup-service').with(
+ :name => platform_params[:ovs_cleanup_service],
+ :enable => true,
+ :ensure => 'running'
+ )
+ should contain_package('neutron-ovs-agent').with_before(/Service\[ovs-cleanup-service\]/)
+ end
end
context 'when supplying a firewall driver' do
@@ -77,7 +79,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:firewall_driver => false)
end
it 'should configure firewall driver' do
- should contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_ensure('absent')
+ should contain_neutron_plugin_ovs('securitygroup/firewall_driver').with_ensure('absent')
end
end
@@ -86,7 +88,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:arp_responder => true)
end
it 'should enable ARP responder' do
- should contain_neutron_plugin_ml2('agent/arp_responder').with_value(true)
+ should contain_neutron_plugin_ovs('agent/arp_responder').with_value(true)
end
end
@@ -96,7 +98,7 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'configures bridge mappings' do
- should contain_neutron_plugin_ml2('ovs/bridge_mappings')
+ should contain_neutron_plugin_ovs('ovs/bridge_mappings')
end
it 'should configure bridge mappings' do
@@ -128,9 +130,9 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:enable_tunneling => true, :local_ip => '127.0.0.1' )
end
it 'should configure ovs for tunneling' do
- should contain_neutron_plugin_ml2('ovs/enable_tunneling').with_value(true)
- should contain_neutron_plugin_ml2('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
- should contain_neutron_plugin_ml2('ovs/local_ip').with_value('127.0.0.1')
+ should contain_neutron_plugin_ovs('ovs/enable_tunneling').with_value(true)
+ should contain_neutron_plugin_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
+ should contain_neutron_plugin_ovs('ovs/local_ip').with_value('127.0.0.1')
should contain_vs_bridge(default_params[:tunnel_bridge]).with(
:ensure => 'present',
:before => 'Service[neutron-ovs-agent-service]'
@@ -147,8 +149,8 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should perform vxlan network configuration' do
- should contain_neutron_plugin_ml2('agent/tunnel_types').with_value(params[:tunnel_types])
- should contain_neutron_plugin_ml2('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
+ should contain_neutron_plugin_ovs('agent/tunnel_types').with_value(params[:tunnel_types])
+ should contain_neutron_plugin_ovs('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
end
end
end
@@ -178,21 +180,5 @@ describe 'neutron::agents::ml2::ovs' do
end
it_configures 'neutron plugin ovs agent with ml2 plugin'
-
- it 'configures neutron ovs cleanup service' do
- should contain_service('ovs-cleanup-service').with(
- :name => platform_params[:ovs_cleanup_service],
- :enable => true,
- :ensure => 'running'
- )
- should contain_package('neutron-ovs-agent').with_before(/Service\[ovs-cleanup-service\]/)
- end
-
- it 'links from ovs config to plugin config' do
- should contain_file('/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini').with(
- :ensure => 'link',
- :target => '/etc/neutron/plugin.ini'
- )
- end
end
end
--
1.8.3.1