diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c2d31fb..1d982a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/metadata.rb b/metadata.rb index f59dc7cc..cd9e9547 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ maintainer 'Jay Pipes ' 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' diff --git a/recipes/linuxbridge.rb b/recipes/linuxbridge.rb index 90d78626..41d656b1 100644 --- a/recipes/linuxbridge.rb +++ b/recipes/linuxbridge.rb @@ -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 diff --git a/recipes/openvswitch.rb b/recipes/openvswitch.rb index b213e5f3..da864025 100644 --- a/recipes/openvswitch.rb +++ b/recipes/openvswitch.rb @@ -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) diff --git a/spec/linuxbridge-redhat_spec.rb b/spec/linuxbridge-redhat_spec.rb index 49a6f388..e81dc14f 100644 --- a/spec/linuxbridge-redhat_spec.rb +++ b/spec/linuxbridge-redhat_spec.rb @@ -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 diff --git a/spec/linuxbridge_spec.rb b/spec/linuxbridge_spec.rb index 59ee6e87..bc723ea1 100644 --- a/spec/linuxbridge_spec.rb +++ b/spec/linuxbridge_spec.rb @@ -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 diff --git a/spec/openvswitch-redhat_spec.rb b/spec/openvswitch-redhat_spec.rb index 4a27def8..71ded21d 100644 --- a/spec/openvswitch-redhat_spec.rb +++ b/spec/openvswitch-redhat_spec.rb @@ -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 diff --git a/spec/openvswitch_spec.rb b/spec/openvswitch_spec.rb index ad6d3348..dd7111ae 100644 --- a/spec/openvswitch_spec.rb +++ b/spec/openvswitch_spec.rb @@ -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