Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LinuxBridge support (vlan tenant networks only, no vxlan support) #147

Open
wants to merge 3 commits into
base: v4.2.2rc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ML2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[email protected]
July 18, 2014

Attributes
==========

Neutron Networking w/ ML2 & LinuxBridge
----

A new plugin attribute has been added. Valid options include ovs or ml2_linuxbridge.

A set of attributes for LinuxBridge have been added. It is not necessary to create a bridge manually; LinuxBridge does this for you. Simply specify the physical interface to use in the bridge.

```javascript

"plugin": "ml2_linuxbridge",
"ml2_linuxbridge": {
"provider_networks": [
{
"label": "ph-eth1",
"bridge": "eth1",
"vlans": ""
}
],
"network_type": "vlan",
"external_bridge": ""
}
```

There is no vxlan support.
24 changes: 24 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@
"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"
default["neutron"]["linuxnet_interface_driver"] =
"nova.network.linux_net.LinuxOVSInterfaceDriver"

if node["neutron"]["plugin"] == "ml2_linuxbridge"
default["neutron"]["libvirt_vif_driver"] =
"nova.virt.libvirt.vif.NeutronLinuxBridgeVIFDriver"
default["neutron"]["linuxnet_interface_driver"] =
"nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver"
end

default["neutron"]["firewall_driver"] =
"nova.virt.firewall.NoopFirewallDriver"
default['neutron']["send_arp_for_ha"] = 3
Expand Down Expand Up @@ -104,6 +112,11 @@
default["neutron"]["services"]["api"]["wsgi_file"] = "neutron-server"

default["neutron"]["db"]["name"] = "neutron"

if node["neutron"]["plugin"] == "ml2_linuxbridge"
default["neutron"]["db"]["name"] = "neutron_ml2"
end

default["neutron"]["db"]["username"] = "neutron"

default["neutron"]["service_tenant_name"] = "service"
Expand All @@ -116,8 +129,13 @@
default["neutron"]["use_namespaces"] = "True" # should correspond to overlap_ips used for dhcp agent and l3 agent.

# Manage plugins here, currently only supports openvswitch (ovs)

default["neutron"]["plugin"] = "ovs"

if node["neutron"]["plugin"] == "ml2_linuxbridge"
default["neutron"]["plugin"] = "ml2_linuxbridge"
end

# dhcp agent options
default["neutron"]["dhcp_lease_time"] = "1440"
default["neutron"]["dhcp_domain"] = "openstacklocal"
Expand Down Expand Up @@ -264,6 +282,12 @@
"neutron-plugin-openvswitch",
"neutron-plugin-openvswitch-agent"
],
"neutron_ml2_linuxbridge_packages" => [
"neutron-plugin-linuxbridge",
"neutron-plugin-linuxbridge-agent",
"python-pip"
],
"neutron_linuxbridge_service_name" => "neutron-plugin-linuxbridge-agent",
"neutron_ovs_service_name" => "neutron-plugin-openvswitch-agent",
"neutron_openvswitch_service_name" => "openvswitch-switch",
"rpcdaemon" => "rpcdaemon"
Expand Down
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
recipe "neutron-dhcp-agent", ""
recipe "neutron-l3-agent", ""
recipe "neutron-ovs-plugin", ""
recipe "neutron-linuxbridge-plugin", ""
recipe "neutron-plugin", ""
recipe "neutron-server", ""
recipe "rpcdaemon", ""
Expand Down
152 changes: 119 additions & 33 deletions recipes/neutron-common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,43 @@

# A comma-separated list of provider network vlan ranges
# => "ph-eth1:1:1000,ph-eth0:1001:1024"
vlan_ranges = node["neutron"]["ovs"]["provider_networks"].map do |network|
if network.has_key?('vlans') and not network['vlans'].empty?
network['vlans'].split(',').each do |vlan_range|
vlan_range.prepend("#{network['label']}:")
if node["neutron"]["plugin"] == "ovs"
vlan_ranges = node["neutron"]["ovs"]["provider_networks"].map do |network|
if network.has_key?('vlans') and not network['vlans'].empty?
network['vlans'].split(',').each do |vlan_range|
vlan_range.prepend("#{network['label']}:")
end
else
network['label']
end
else
network['label']
end
end.join(',')
end.join(',')
end

if node["neutron"]["plugin"] == "ml2_linuxbridge"
vlan_ranges = node["neutron"]["ml2_linuxbridge"]["provider_networks"].map do |network|
if network.has_key?('vlans') and not network['vlans'].empty?
network['vlans'].split(',').each do |vlan_range|
vlan_range.prepend("#{network['label']}:")
end
else
network['label']
end
end.join(',')
end

# A comma-separated list of provider network to bridge mappings
# => "ph-eth1:br-eth1,ph-eth0:br-eth0"
bridge_mappings = node["neutron"]["ovs"]["provider_networks"].map do |network|
"#{network['label']}:#{network['bridge']}"
end.join(',')
if node["neutron"]["plugin"] == "ovs"
bridge_mappings = node["neutron"]["ovs"]["provider_networks"].map do |network|
"#{network['label']}:#{network['bridge']}"
end.join(',')
end

if node["neutron"]["plugin"] == "ml2_linuxbridge"
bridge_mappings = node["neutron"]["ml2_linuxbridge"]["provider_networks"].map do |network|
"#{network['label']}:#{network['bridge']}"
end.join(',')
end

# Make sure our permissions are not too, well, permissive
directory "/etc/neutron/" do
Expand All @@ -89,6 +111,22 @@
recursive true
end

directory "/etc/neutron/plugins/ml2" do
action :create
owner "root"
group "neutron"
mode "750"
recursive true
end

directory "/etc/neutron/plugins/linuxbridge" do
action :create
owner "root"
group "neutron"
mode "750"
recursive true
end

notification_provider = node["neutron"]["notification"]["driver"]
case notification_provider
when "no_op"
Expand Down Expand Up @@ -138,6 +176,17 @@
group "neutron"
end

#Drop the config file for /etc/default/neutron-server
template "/etc/default/neutron-server" do
source "neutron-server.erb"
owner "root"
group "neutron"
mode "0640"
variables(
"neutron_plugin" => node["neutron"]["plugin"]
)
end

template "/etc/neutron/neutron.conf" do
source "neutron.conf.erb"
owner "root"
Expand Down Expand Up @@ -198,28 +247,65 @@
)
end

template "/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" do
source "ovs_neutron_plugin.ini.erb"
owner "root"
group "neutron"
mode "0640"
variables(
"db_ip_address" => mysql_info["host"],
"db_user" => neutron_info["db"]["username"],
"db_password" => neutron_info["db"]["password"],
"db_name" => neutron_info["db"]["name"],
"ovs_firewall_driver" => node["neutron"]["ovs"]["firewall_driver"],
"ovs_network_type" => node["neutron"]["ovs"]["network_type"],
"ovs_tunnel_ranges" => node["neutron"]["ovs"]["tunnel_ranges"],
"ovs_integration_bridge" => node["neutron"]["ovs"]["integration_bridge"],
"ovs_tunnel_bridge" => node["neutron"]["ovs"]["tunnel_bridge"],
"sqlalchemy_pool_size" => node["neutron"]["database"]["sqlalchemy_pool_size"],
"ovs_vlan_range" => vlan_ranges,
"ovs_bridge_mapping" => bridge_mappings,
"ovs_debug" => node["neutron"]["debug"],
"ovs_verbose" => node["neutron"]["verbose"],
"ovs_local_ip" => local_ip
)

if node["neutron"]["plugin"] == "ovs"
template "/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" do
source "ovs_neutron_plugin.ini.erb"
owner "root"
group "neutron"
mode "0640"
variables(
"db_ip_address" => mysql_info["host"],
"db_user" => neutron_info["db"]["username"],
"db_password" => neutron_info["db"]["password"],
"db_name" => neutron_info["db"]["name"],
"ovs_firewall_driver" => node["neutron"]["ovs"]["firewall_driver"],
"ovs_network_type" => node["neutron"]["ovs"]["network_type"],
"ovs_tunnel_ranges" => node["neutron"]["ovs"]["tunnel_ranges"],
"ovs_integration_bridge" => node["neutron"]["ovs"]["integration_bridge"],
"ovs_tunnel_bridge" => node["neutron"]["ovs"]["tunnel_bridge"],
"sqlalchemy_pool_size" => node["neutron"]["database"]["sqlalchemy_pool_size"],
"ovs_vlan_range" => vlan_ranges,
"ovs_bridge_mapping" => bridge_mappings,
"ovs_debug" => node["neutron"]["debug"],
"ovs_verbose" => node["neutron"]["verbose"],
"ovs_local_ip" => local_ip
)
end
end

if node["neutron"]["plugin"] == "ml2_linuxbridge"
template "/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini" do
source "linuxbridge_conf.ini.erb"
owner "root"
group "neutron"
mode "0640"
variables(
"neutron_plugin" => node["neutron"]["plugin"],
"lb_firewall_driver" => node["neutron"]["ml2_linuxbridge"]["firewall_driver"],
"lb_network_type" => node["neutron"]["ml2_linuxbridge"]["network_type"],
"lb_vlan_range" => vlan_ranges,
"lb_bridge_mapping" => bridge_mappings,
"lb_debug" => node["neutron"]["debug"],
"lb_verbose" => node["neutron"]["verbose"]
)
end

template "/etc/neutron/plugins/ml2/ml2_conf.ini" do
source "ml2_conf.ini.erb"
owner "root"
group "neutron"
mode "0640"
variables(
"neutron_plugin" => node["neutron"]["plugin"],
"db_ip_address" => mysql_info["host"],
"db_user" => neutron_info["db"]["username"],
"db_password" => neutron_info["db"]["password"],
"db_name" => neutron_info["db"]["name"],
"sqlalchemy_pool_size" => node["neutron"]["database"]["sqlalchemy_pool_size"],
"lb_vlan_range" => vlan_ranges
)
end
end

case node['platform']
Expand Down
18 changes: 9 additions & 9 deletions recipes/neutron-l3-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
subscribes :restart, "template[/etc/neutron/l3-agent.ini]", :delayed
end


execute "create external bridge" do
command "ovs-vsctl add-br #{node["neutron"]["ovs"]["external_bridge"]}"
action :run
not_if "ovs-vsctl get bridge \"#{node["neutron"]["ovs"]["external_bridge"]}\" name"
not_if { node["neutron"]["ovs"]["external_bridge"].nil? }
not_if { node["neutron"]["ovs"]["external_bridge"].empty? }
if node["neutron"]["plugin"] == "ovs"
execute "create external bridge" do
command "ovs-vsctl add-br #{node["neutron"]["ovs"]["external_bridge"]}"
action :run
not_if "ovs-vsctl get bridge \"#{node["neutron"]["ovs"]["external_bridge"]}\" name"
not_if { node["neutron"]["ovs"]["external_bridge"].nil? }
not_if { node["neutron"]["ovs"]["external_bridge"].empty? }
end
end


nova_info =
get_access_endpoint("nova-api-os-compute", "nova", "api")
metadata_ip =
Expand All @@ -67,7 +67,7 @@
group "root"
mode "0644"
variables(
"neutron_external_bridge" => node["neutron"][plugin]["external_bridge"],
"neutron_external_bridge" => node["neutron"]["#{node["neutron"]["plugin"]}"]["external_bridge"],
"nova_metadata_ip" => metadata_ip,
"neutron_plugin" => node["neutron"]["plugin"],
"send_arp_for_ha" => node["neutron"]["send_arp_for_ha"]
Expand Down
65 changes: 65 additions & 0 deletions recipes/neutron-linuxbridge-plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Cookbook Name:: nova-network
# Recipe:: neutron-ovs-plugin
#
# Copyright 2012-2013, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include_recipe "osops-utils"
include_recipe "nova-network::neutron-common"

platform_options = node["neutron"]["platform"]
plugin = node["neutron"]["plugin"]

return if node["neutron"]["plugin"] == "ovs"

platform_options["neutron_#{plugin}_packages"].each do |pkg|
package pkg do
action node["osops"]["do_package_upgrades"] == true ? :upgrade : :install
options platform_options["package_options"]
end
end

service "neutron-plugin-linuxbridge-agent" do
service_name platform_options["neutron_linuxbridge_service_name"]
supports :status => true, :restart => true
action :enable
subscribes :restart, "template[/etc/neutron/neutron.conf]", :delayed
subscribes :restart, "template[/etc/neutron/plugins/ml2/ml2_conf.ini]", :delayed
subscribes :restart, "template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]", :delayed
end

case node['platform']
when 'redhat', 'centos'
platform_options['epel_openstack_packages'].each do |pkg|
package pkg do
# Since these packages are already installed from [base] and we want
# to replace them, we need action :upgrade to make chef install the
# alternate versions.
# XXX Assumes versions from [epel-openstack] > [base]
action :upgrade

# Force yum to search the epel-openstack repo.
# FIXME(brett) Don't hardcode repo name (hardcoded in osops::packages).
# Maybe dynamically get name from `yum repolist'.
options '--disablerepo="*" --enablerepo=epel-openstack'

# To protect ourselves from future chef runs, don't always upgrade
# packages when updates are available (maybe consider checking
# 'do_package_upgrades' though?). Unfortunately the release versioning
# convention isn't consistent across packages in this repo, so we can't
# simply grep 'openstack' or similar.
not_if "rpm -q --qf '%{RELEASE}\\n' #{pkg} |grep -E '\\.el6(ost|\\.gre)\\.'"
end
end
end
1 change: 1 addition & 0 deletions recipes/neutron-ovs-plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
platform_options = node["neutron"]["platform"]
plugin = node["neutron"]["plugin"]

return if node["neutron"]["plugin"] == "ml2_linuxbridge"

platform_options["neutron_#{plugin}_packages"].each do |pkg|
package pkg do
Expand Down
2 changes: 2 additions & 0 deletions recipes/neutron-plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@
case node["neutron"]["plugin"]
when "ovs"
include_recipe "nova-network::neutron-ovs-plugin"
when "ml2_linuxbridge"
include_recipe "nova-network::neutron-linuxbridge-plugin"
end
Loading