Allow data network openvswitch bridge to be created
Allow data network ovs bridge to be created for flat and vlan. Add attributes to control creation. Add Tests. Change-Id: I4d4cb79c40f849193c5ff1a79c88b7049886d594 Closes-Bug: #1307587
This commit is contained in:
parent
904016e6e8
commit
841d4fce05
|
@ -1,6 +1,9 @@
|
|||
# CHANGELOG for cookbook-openstack-network
|
||||
|
||||
This file is used to list changes made in each version of cookbook-openstack-network.
|
||||
## 9.0.2
|
||||
* Fix to allow data network openvswitch bridge to be created
|
||||
|
||||
## 9.0.1
|
||||
* Fix package action to allow updates
|
||||
|
||||
|
|
|
@ -430,6 +430,14 @@ default['openstack']['network']['openvswitch']['tun_peer_patch_port'] = nil
|
|||
# Example: bridge_mappings = physnet1:br-eth1
|
||||
default['openstack']['network']['openvswitch']['bridge_mappings'] = nil
|
||||
|
||||
# Create OVS data network bridge for the physical network and configure it
|
||||
# with the specified port. If nil or empty string is specified, the data
|
||||
# network bridge will not be created.
|
||||
# Format: <data network bridge name>:<external interface>
|
||||
#
|
||||
# Example: bridge_mapping_interface = br-eth1:eth1
|
||||
default['openstack']['network']['openvswitch']['bridge_mapping_interface'] = nil
|
||||
|
||||
# Agent's polling interval in seconds
|
||||
default['openstack']['network']['openvswitch']['polling_interval'] = 2
|
||||
|
||||
|
|
|
@ -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.1'
|
||||
version '9.0.2'
|
||||
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'
|
||||
|
|
|
@ -126,6 +126,20 @@ unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)
|
|||
end
|
||||
end
|
||||
|
||||
unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)
|
||||
unless node['openstack']['network']['openvswitch']['bridge_mapping_interface'].to_s.empty?
|
||||
ext_bridge_mapping = node['openstack']['network']['openvswitch']['bridge_mapping_interface']
|
||||
ext_bridge, ext_bridge_iface = ext_bridge_mapping.split(':')
|
||||
execute 'create data network bridge' do
|
||||
command "ovs-vsctl add-br #{ext_bridge} -- add-port #{ext_bridge} #{ext_bridge_iface}"
|
||||
action :run
|
||||
not_if "ovs-vsctl br-exists #{ext_bridge}"
|
||||
only_if "ip link show #{ext_bridge_iface}"
|
||||
notifies :restart, 'service[neutron-plugin-openvswitch-agent]', :delayed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if node['openstack']['network']['disable_offload']
|
||||
|
||||
package 'ethtool' do
|
||||
|
|
|
@ -165,5 +165,44 @@ describe 'openstack-network::openvswitch' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'create ovs data network bridge' do
|
||||
let(:cmd) { 'ovs-vsctl add-br br-eth1 -- add-port br-eth1 eth1' }
|
||||
|
||||
it 'does not add data network bridge if it already exists' do
|
||||
node.set['openstack']['network']['openvswitch']['bridge_mapping_interface'] = 'br-eth1:eth1'
|
||||
stub_command(/ovs-vsctl br-exists br-eth1/).and_return(true)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'does not add data network bridge if the physical interface does not exist' do
|
||||
node.set['openstack']['network']['openvswitch']['bridge_mapping_interface'] = 'br-eth1:eth1'
|
||||
stub_command(/ovs-vsctl br-exists br-eth1/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(false)
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'adds data network bridge if it does not yet exist and physical interface exists' do
|
||||
node.set['openstack']['network']['openvswitch']['bridge_mapping_interface'] = 'br-eth1:eth1'
|
||||
stub_command(/ovs-vsctl br-exists br-eth1/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
expect(chef_run).to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'does not add data network bridge if nil specified for bridge mapping' do
|
||||
node.set['openstack']['network']['openvswitch']['bridge_mapping_interface'] = nil
|
||||
stub_command(/ovs-vsctl br-exists br-eth1/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
|
||||
it 'does not add data network bridge if emtpy string specified for bridge mapping' do
|
||||
node.set['openstack']['network']['openvswitch']['bridge_mapping_interface'] = ''
|
||||
stub_command(/ovs-vsctl br-exists br-eth1/).and_return(false)
|
||||
stub_command(/ip link show eth1/).and_return(true)
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue