Fix openvswitch and linux bridge agent confs for ml2 on redhat

The agent conf files were not being created when using ml2 on redhat.
This patch creates the conf directory and file for the agent recipes.
For openvsiwtch, it's specific to redhat, as debian uses different conf
file, reported under this bug 1314751.
For linuxbridge, it's the same conf for both redhat and ubuntu.

See bug for more details.

Change-Id: Iae8fff68c5b270593ba9c23ecc8deac7577e2382
Closes-Bug: #1311311
This commit is contained in:
Mark Vanderwiel 2014-05-06 12:46:34 -05:00
parent 841d4fce05
commit 268552e009
8 changed files with 92 additions and 1 deletions

View File

@ -1,4 +1,6 @@
# CHANGELOG for cookbook-openstack-network
## 9.0.3
* Fix openvswitch and linuxbridge agent
This file is used to list changes made in each version of cookbook-openstack-network.
## 9.0.2

View File

@ -5,7 +5,7 @@ maintainer 'Jay Pipes <jaypipes@gmail.com>'
license 'Apache 2.0'
description 'Installs and configures the OpenStack Network API Service and various agents and plugins'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '9.0.2'
version '9.0.3'
recipe 'openstack-network::client', 'Install packages required for network client'
recipe 'openstack-network::server', 'Installs packages required for a OpenStack Network server'
recipe 'openstack-network::openvswitch', 'Installs packages required for OVS'

View File

@ -31,9 +31,28 @@ platform_options['neutron_linuxbridge_agent_packages'].each do |pkg|
end
end
directory '/etc/neutron/plugins/linuxbridge' do
recursive true
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00700
end
linuxbridge_endpoint = endpoint 'network-linuxbridge'
template '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
source 'plugins/linuxbridge/linuxbridge_conf.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
variables(
local_ip: linuxbridge_endpoint.host
)
end
service 'neutron-plugin-linuxbridge-agent' do
service_name platform_options['neutron_linuxbridge_agent_service']
supports status: true, restart: true
action :enable
subscribes :restart, 'template[/etc/neutron/neutron.conf]'
subscribes :restart, 'template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]'
end

View File

@ -97,11 +97,34 @@ platform_options['neutron_openvswitch_agent_packages'].each do |pkg|
end
end
directory '/etc/neutron/plugins/openvswitch' do
recursive true
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00700
only_if { platform_family?('rhel') }
end
openvswitch_endpoint = endpoint 'network-openvswitch'
template '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini' do
source 'plugins/openvswitch/ovs_neutron_plugin.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
variables(
local_ip: openvswitch_endpoint.host
)
only_if { platform_family?('rhel') }
end
service 'neutron-plugin-openvswitch-agent' do
service_name platform_options['neutron_openvswitch_agent_service']
supports status: true, restart: true
action :enable
subscribes :restart, 'template[/etc/neutron/neutron.conf]'
if platform_family?('rhel')
subscribes :restart, 'template[/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini]'
end
end
unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)

View File

@ -26,6 +26,14 @@ describe 'openstack-network::linuxbridge' do
expect(chef_run).to upgrade_package('openstack-neutron-linuxbridge')
end
it 'creates the /etc/neutron/plugins/linuxbridge agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/linuxbridge').with(
owner: 'neutron',
group: 'neutron',
mode: 0700
)
end
it 'sets the linuxbridge service to start on boot' do
expect(chef_run).to enable_service('neutron-linuxbridge-agent')
end
@ -33,6 +41,14 @@ describe 'openstack-network::linuxbridge' do
describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
let(:file) { chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini') }
it 'creates ovs_neutron_plugin.ini' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
it 'notifies to create symbolic link' do
expect(file).to notify('link[/etc/neutron/plugin.ini]').to(:create).immediately
end

View File

@ -25,6 +25,14 @@ describe 'openstack-network::linuxbridge' do
expect(chef_run).to upgrade_package('neutron-plugin-linuxbridge-agent')
end
it 'creates the /etc/neutron/plugins/linuxbridge agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/linuxbridge').with(
owner: 'neutron',
group: 'neutron',
mode: 0700
)
end
it 'sets the linuxbridge service to start on boot' do
expect(chef_run).to enable_service('neutron-plugin-linuxbridge-agent')
end

View File

@ -19,5 +19,20 @@ describe 'openstack-network::openvswitch' do
expect(file).to notify('link[/etc/neutron/plugin.ini]').to(:create).immediately
end
it 'creates the /etc/neutron/plugins/openvswitch agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/openvswitch').with(
owner: 'neutron',
group: 'neutron',
mode: 0700
)
end
it 'creates ovs_neutron_plugin.ini' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
end
end

View File

@ -56,6 +56,14 @@ describe 'openstack-network::openvswitch' do
expect(chef_run).to upgrade_package 'neutron-plugin-openvswitch-agent'
end
it 'creates the /etc/neutron/plugins/openvswitch agent directory' do
expect(chef_run).to create_directory('/etc/neutron/plugins/openvswitch').with(
owner: 'neutron',
group: 'neutron',
mode: 0700
)
end
it 'sets the openvswitch service to start on boot' do
expect(chef_run).to enable_service 'neutron-plugin-openvswitch-agent'
end