Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Merge pull request #108 from VictorLowther/pull-req-fix-ovs-package-i…
Browse files Browse the repository at this point in the history
…nstall-order

#108

Merged by devtool for ArkadyKanevsky
  • Loading branch information
Arkady Kanevsky committed Jul 31, 2013
2 parents 33496ca + 1a86336 commit e5cc33c
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 233 deletions.
4 changes: 2 additions & 2 deletions chef/cookbooks/quantum/attributes/default.rb
Expand Up @@ -76,8 +76,8 @@
:dhcp_agent_name => "quantum-dhcp-agent",
:l3_agent_name => "quantum-l3-agent",
:ovs_pkgs => [ "linux-headers-#{`uname -r`.strip}",
"openvswitch-switch",
"openvswitch-datapath-dkms" ],
"openvswitch-datapath-dkms",
"openvswitch-switch" ],
:user => "quantum",
:ovs_modprobe => "modprobe openvswitch"
}
Expand Down
54 changes: 43 additions & 11 deletions chef/cookbooks/quantum/recipes/common_install.rb
Expand Up @@ -37,6 +37,20 @@
keystone = quantum
end

# If we expect to install the openvswitch module via DKMS, but the module does not
# exist, rmmod the openvswitch module before continuing.
if node[:quantum][:platform][:ovs_pkgs].any?{|e|e == "openvswitch-datapath-dkms"} &&
!File.exists?("/lib/modules/#{%x{uname -r}.strip}/updates/dkms/openvswitch.ko") &&
File.directory?("/sys/module/openvswitch")
if IO.read("/sys/module/openvswitch").strip != "0"
Chef::Log.error("Kernel openvswitch module already loaded and in use! Please reboot me!")
else
bash "Unload non-DKMS openvswitch module" do
code "rmmod openvswitch"
end
end
end

node[:quantum][:platform][:ovs_pkgs].each { |p| package p }

bash "Load openvswitch module" do
Expand Down Expand Up @@ -164,11 +178,6 @@
end
end

service quantum_agent do
supports :status => true, :restart => true
action :enable
end

#env_filter = " AND nova_config_environment:nova-config-#{node[:tempest][:nova_instance]}"
#assuming we have only one nova
#TODO: nova should depend on quantum, but quantum depend on nova a bit, so we have to do somthing with this
Expand Down Expand Up @@ -219,10 +228,22 @@
vlan_start = node[:network][:networks][:nova_fixed][:vlan]
vlan_end = vlan_start + 2000

link "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini" do
to "/etc/quantum/quantum.conf"
notifies :restart, resources(:service => quantum_agent), :immediately
notifies :restart, resources(:service => "openvswitch-switch"), :immediately
template "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini" do
cookbook "quantum"
source "ovs_quantum_plugin.ini.erb"
mode "0640"
owner node[:quantum][:platform][:user]
variables(
:sql_connection => quantum[:quantum][:db][:ovs_sql_connection],
:sql_idle_timeout => quantum[:quantum][:sql][:idle_timeout],
:sql_min_pool_size => quantum[:quantum][:sql][:min_pool_size],
:sql_max_pool_size => quantum[:quantum][:sql][:max_pool_size],
:networking_mode => quantum[:quantum][:networking_mode],
:rootwrap_bin => node[:quantum][:rootwrap],
:physnet => quantum[:quantum][:networking_mode] == 'gre' ? "br-tunnel" : "br-fixed",
:vlan_start => vlan_start,
:vlan_end => vlan_end
)
end

template "/etc/quantum/quantum.conf" do
Expand Down Expand Up @@ -256,7 +277,18 @@
:vlan_start => vlan_start,
:vlan_end => vlan_end,
:physnet => quantum[:quantum][:networking_mode] == 'gre' ? "br-tunnel" : "br-fixed",
:rootwrap_bin => quantum[:quantum][:rootwrap]
:rootwrap_bin => node[:quantum][:rootwrap]
)
notifies :restart, resources(:service => quantum_agent), :immediately
end

service quantum_agent do
supports :status => true, :restart => true
action :enable
subscribes :restart, "template[/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini]", :immediately
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
end





50 changes: 23 additions & 27 deletions chef/cookbooks/quantum/recipes/server.rb
Expand Up @@ -16,11 +16,19 @@
unless node[:quantum][:use_gitrepo]
pkgs = node[:quantum][:platform][:pkgs]
pkgs.each { |p| package p }
file "/etc/default/quantum-server" do
action :delete
not_if { node[:platform] == "suse" }

template "/etc/default/quantum-server" do
source "ubuntu.default.quantum-server.erb"
owner "root"
group "root"
mode 0640
variables(
:plugin_config_file => "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini"
)
notifies :restart, "service[#{node[:quantum][:platform][:service_name]}]"
only_if { node[:platform] == "ubuntu" }
end

template "/etc/sysconfig/quantum" do
source "suse.sysconfig.quantum.erb"
owner "root"
Expand Down Expand Up @@ -168,8 +176,8 @@
service node[:quantum][:platform][:metadata_agent_name] do
supports :status => true, :restart => true
action :enable
subscribes :restart, resources("template[/etc/quantum/quantum.conf]")
subscribes :restart, resources("template[/etc/quantum/metadata_agent.ini]")
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
subscribes :restart, "template[/etc/quantum/metadata_agent.ini]", :immediately
end

directory "/etc/quantum/plugins/openvswitch/" do
Expand All @@ -180,47 +188,35 @@
end

unless node[:quantum][:use_gitrepo]
link "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini" do
to "/etc/quantum/quantum.conf"
end
service node[:quantum][:platform][:service_name] do
supports :status => true, :restart => true
action :enable
subscribes :restart, resources("template[/etc/quantum/api-paste.ini]"), :immediately
subscribes :restart, resources("link[/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini]"), :immediately
subscribes :restart, resources("template[/etc/quantum/quantum.conf]")
subscribes :restart, "template[/etc/quantum/api-paste.ini]", :immediately
subscribes :restart, "template[/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini]", :immediately
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
end
else
template "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini" do
source "ovs_quantum_plugin.ini.erb"
owner node[:quantum][:platform][:user]
group "root"
mode "0640"
variables(
:ovs_sql_connection => node[:quantum][:db][:sql_connection]
)
end
service quantum_service_name do
supports :status => true, :restart => true
action :enable
subscribes :restart, resources("template[/etc/quantum/api-paste.ini]"), :immediately
subscribes :restart, resources("template[/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini]"), :immediately
subscribes :restart, resources("template[/etc/quantum/quantum.conf]")
subscribes :restart, "template[/etc/quantum/api-paste.ini]", :immediately
subscribes :restart, "template[/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini]", :immediately
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
end
end

service node[:quantum][:platform][:dhcp_agent_name] do
supports :status => true, :restart => true
action :enable
subscribes :restart, resources("template[/etc/quantum/quantum.conf]")
subscribes :restart, resources("template[/etc/quantum/dhcp_agent.ini]")
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
subscribes :restart, "template[/etc/quantum/dhcp_agent.ini]", :immediately
end

service node[:quantum][:platform][:l3_agent_name] do
supports :status => true, :restart => true
action :enable
subscribes :restart, resources("template[/etc/quantum/quantum.conf]")
subscribes :restart, resources("template[/etc/quantum/l3_agent.ini]")
subscribes :restart, "template[/etc/quantum/quantum.conf]", :immediately
subscribes :restart, "template[/etc/quantum/l3_agent.ini]", :immediately
end

include_recipe "quantum::post_install_conf"
Expand Down
127 changes: 18 additions & 109 deletions chef/cookbooks/quantum/templates/default/ovs_quantum_plugin.ini.erb
@@ -1,118 +1,27 @@
[DATABASE]
# This line MUST be changed to actually run the plugin.
# Example:
# sql_connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum
# Replace 127.0.0.1 above with the IP address of the database used by the
# main quantum server. (Leave it as is if the database runs on this host.)
#sql_connection = sqlite://
sql_connection = <%= @ovs_sql_connection %>

# Database reconnection retry times - in event connectivity is lost
# set to -1 implies an infinite retry count
# sql_max_retries = 10
# Database reconnection interval in seconds - in event connectivity is lost
sql_connection = <%= @sql_connection %>
sql_idle_timeout = <%= @sql_idle_timeout %>
sql_max_pool_size = <%= @sql_max_pool_size %>
sql_min_pool_size = <%= @sql_min_pool_size %>
reconnect_interval = 2

[OVS]
# (StrOpt) Type of network to allocate for tenant networks. The
# default value 'local' is useful only for single-box testing and
# provides no connectivity between hosts. You MUST either change this
# to 'vlan' and configure network_vlan_ranges below or change this to
# 'gre' and configure tunnel_id_ranges below in order for tenant
# networks to provide connectivity between hosts. Set to 'none' to
# disable creation of tenant networks.
#
# Default: tenant_network_type = local
# Example: tenant_network_type = gre

# (ListOpt) Comma-separated list of
# <physical_network>[:<vlan_min>:<vlan_max>] tuples enumerating ranges
# of VLAN IDs on named physical networks that are available for
# allocation. All physical networks listed are available for flat and
# VLAN provider network creation. Specified ranges of VLAN IDs are
# available for tenant network allocation if tenant_network_type is
# 'vlan'. If empty, only gre and local networks may be created.
#
# Default: network_vlan_ranges =
# Example: network_vlan_ranges = physnet1:1000:2999

<% if @networking_mode == 'vlan' -%>
tenant_network_type = vlan
network_vlan_ranges = physnet1:<%= @vlan_start %>:<%= @vlan_end %>
<% elsif @networking_mode == 'gre' -%>
tenant_network_type = gre
tunnel_bridge = <%=@physnet%>
tunnel_id_ranges = <%= node[:quantum][:network][:gre_start]%>:<%= node[:quantum][:network][:gre_stop]%>
local_ip = <%= node.address("os_sdn").addr %>
enable_tunneling = True
<% else -%>
tenant_network_type = local
network_vlan_ranges = physnet1

# (BoolOpt) Set to True in the server and the agents to enable support
# for GRE networks. Requires kernel support for OVS patch ports and
# GRE tunneling.
#
# Default: enable_tunneling = False

# (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples
# enumerating ranges of GRE tunnel IDs that are available for tenant
# network allocation if tenant_network_type is 'gre'.
#
# Default: tunnel_id_ranges =
# Example: tunnel_id_ranges = 1:1000

# Do not change this parameter unless you have a good reason to.
# This is the name of the OVS integration bridge. There is one per hypervisor.
# The integration bridge acts as a virtual "patch bay". All VM VIFs are
# attached to this bridge and then "patched" according to their network
# connectivity.
#
# Default: integration_bridge = br-int

# Only used for the agent if tunnel_id_ranges (above) is not empty for
# the server. In most cases, the default value should be fine.
#
# Default: tunnel_bridge = br-tun

# Uncomment this line for the agent if tunnel_id_ranges (above) is not
# empty for the server. Set local-ip to be the local IP address of
# this hypervisor.
#
# Default: local_ip =

# (ListOpt) Comma-separated list of <physical_network>:<bridge> tuples
# mapping physical network names to the agent's node-specific OVS
# bridge names to be used for flat and VLAN networks. Each bridge must
# exist, and should have a physical network interface configured as a
# port. All physical networks listed in network_vlan_ranges on the
# server should have mappings to appropriate bridges on each agent.
#
# Default: bridge_mappings =
# Example: bridge_mappings = physnet1:br-eth1
<% end -%>
bridge_mappings = physnet1:<%=@physnet%>

[AGENT]
# Agent's polling interval in seconds
polling_interval = 2
# Use "sudo quantum-rootwrap /etc/quantum/rootwrap.conf" to use the real
# root filter facility.
# Change to "sudo" to skip the filtering and just run the comand directly
root_helper = sudo

#-----------------------------------------------------------------------------
# Sample Configurations.
#-----------------------------------------------------------------------------
#
# 1. With VLANs on eth1.
# [DATABASE]
# sql_connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum
# [OVS]
# network_vlan_ranges = default:2000:3999
# tunnel_id_ranges =
# integration_bridge = br-int
# bridge_mappings = default:br-eth1
# [AGENT]
# root_helper = sudo
# Add the following setting, if you want to log to a file
#
# 2. With tunneling.
# [DATABASE]
# sql_connection = mysql://root:nova@127.0.0.1:3306/ovs_quantum
# [OVS]
# network_vlan_ranges =
# tunnel_id_ranges = 1:1000
# integration_bridge = br-int
# tunnel_bridge = br-tun
# local_ip = 10.0.0.3
# [AGENT]
# root_helper = sudo

root_helper=sudo <%=@rootwrap_bin%> /etc/quantum/rootwrap.conf

0 comments on commit e5cc33c

Please sign in to comment.