Skip to content

Instantly share code, notes, and snippets.

@pcn
Created September 23, 2014 20:57
Show Gist options
  • Save pcn/6a7ee160521ed9bc3d68 to your computer and use it in GitHub Desktop.
Save pcn/6a7ee160521ed9bc3d68 to your computer and use it in GitHub Desktop.
Fixup neutron to write the ml2_conf.ini to the openvswitch.ini so that it works.
<%= node['openstack']['network']['custom_template_banner'] %>
[ml2]
# (ListOpt) List of network type driver entrypoints to be loaded from
# the neutron.ml2.type_drivers namespace.
#
# type_drivers = local,flat,vlan,gre,vxlan
# Example: type_drivers = flat,vlan,gre,vxlan
type_drivers = <%= node['openstack']['network']['ml2']['type_drivers'] %>
# (ListOpt) Ordered list of network_types to allocate as tenant
# networks. The default value 'local' is useful for single-box testing
# but provides no connectivity between hosts.
#
# tenant_network_types = local
# Example: tenant_network_types = vlan,gre,vxlan
tenant_network_types = <%= node['openstack']['network']['ml2']['tenant_network_types'] %>
# (ListOpt) Ordered list of networking mechanism driver entrypoints
# to be loaded from the neutron.ml2.mechanism_drivers namespace.
# mechanism_drivers =
# Example: mechanism_drivers = arista
# Example: mechanism_drivers = cisco,logger
mechanism_drivers = <%= node['openstack']['network']['ml2']['mechanism_drivers'] %>
[ml2_type_flat]
# (ListOpt) List of physical_network names with which flat networks
# can be created. Use * to allow flat networks with arbitrary
# physical_network names.
#
# flat_networks =
# Example:flat_networks = physnet1,physnet2
# Example:flat_networks = *
flat_networks = <%= node['openstack']['network']['ml2']['flat_networks'] %>
[ml2_type_vlan]
# (ListOpt) List of <physical_network>[:<vlan_min>:<vlan_max>] tuples
# specifying physical_network names usable for VLAN provider and
# tenant networks, as well as ranges of VLAN tags on each
# physical_network available for allocation as tenant networks.
#
# network_vlan_ranges =
# Example: network_vlan_ranges = physnet1:1000:2999,physnet2
network_vlan_ranges = <%= node['openstack']['network']['ml2']['network_vlan_ranges'] %>
[ml2_type_gre]
# (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples enumerating ranges of GRE tunnel IDs that are available for tenant network allocation
tunnel_id_ranges = <%= node['openstack']['network']['ml2']['tunnel_id_ranges'] %>
[ml2_type_vxlan]
# (ListOpt) Comma-separated list of <vni_min>:<vni_max> tuples enumerating
# ranges of VXLAN VNI IDs that are available for tenant network allocation.
vni_ranges = <%= node['openstack']['network']['ml2']['vni_ranges'] %>
# (StrOpt) Multicast group for the VXLAN interface. When configured, will
# enable sending all broadcast traffic to this multicast group. When left
# unconfigured, will disable multicast VXLAN mode.
#
# vxlan_group =
# Example: vxlan_group = 239.1.1.1
vxlan_group = <%= node['openstack']['network']['ml2']['vxlan_group'] %>
[securitygroup]
# Controls if neutron security group is enabled or not.
# It should be false when you use nova security group.
enable_security_group = <%= node['openstack']['network']['ml2']['enable_security_group'] %>
<% if node['openstack']['network']['ml2']['type_drivers'].include?("vxlan") %>
# As of icehouse, neutron with gre or vxlan requires that the ml2_conf.ini
# have OVS-related config as well, and that the same config be in the ml2 conf
# and the openvswitch config at /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
# and at /etc/neutron/plugins/ml2/ml2_conf.ini
firewall_driver = <%= node['openstack']['network']['ml2']['firewall_driver'] %>
[ovs]
local_ip = <%= node['openstack']['network']['ml2']['openvswitch']['local_ip'] %>
enable_tunneling = <%= node['openstack']['network']['ml2']['openvswitch']['enable_tunneling'] %>
tunnel_type = <%= node['openstack']['network']['ml2']['openvswitch']['tunnel_type'] %>
[agent]
tunnel_types = <%= node['openstack']['network']['ml2']['openvswitch']['tunnel_type'] %>
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
<% end %>
chef_gem "chef-rewind"
require 'chef/rewind'
include_recipe "openstack-common" # include for the endpoint library method address_for
include_recipe "openstack-network::common"
core_plugin = node['openstack']['network']['core_plugin']
main_plugin = node['openstack']['network']['core_plugin_map'][core_plugin.split('.').last.downcase]
case main_plugin
when 'ml2'
# If this works, it should be submitted as a patch to openstack-chef
# for the neutron::common recipe.
local_ip = address_for(node['openstack']['network']['ml2']['openvswitch']['local_ip_interface'])
node.normal['openstack']['network']['ml2']['openvswitch']['local_ip'] = local_ip
rewind :template => "/etc/neutron/plugins/ml2/ml2_conf.ini" do
source "plugins/ml2/my-ml2_conf.ini.erb"
cookbook_name "openstack-rewind-fixes"
end
case node['openstack']['network']['ml2']['openvswitch']['tunnel_type']
when 'vxlan'
template_file = "/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
template template_file do
source 'plugins/ml2/my-ml2_conf.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
notifies :restart, 'service[neutron-server]', :delayed
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment