Add NIC offload disable feature

On some ubuntu kernels with some versions
of Openvswitch and Nicira, when NIC offloading
is enabled on the adapter, the kernel may OOPS
within the openvswitch module.  There is now a flag
to attempt to disable all offload settings for the
adapter prior to openvswitch service startup.

Change-Id: I61b195c69fbb827876de1c3537cece01f36c6db0
This commit is contained in:
Alan Meadows 2013-08-13 12:52:32 -07:00
parent 4c428ad08c
commit f167c17cf4
3 changed files with 110 additions and 0 deletions

View File

@ -72,6 +72,12 @@ default["openstack"]["network"]["api"]["bind_port"] = 9696
# logging attribute
default["openstack"]["network"]["syslog"]["use"] = false
# Whether or not we want to disable offloading
# on all the NIC interfaces (currently only supports
# ubuntu and debian). This can help if openvswitch
# or nicira plugins are crashing the sdn routers
default['openstack']['network']['disable_offload'] = false
# the plugins to install on the server. this will be
# quantum-plugin-%plugin% and the first plugin in the
# list should match the core plugin below

View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
#
# Copyright (C) 2013 ATT Services, 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.
#
### BEGIN INIT INFO
# Provides: disable-eth-offload
# Required-Start: $network
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable NIC Offloads
### END INIT INFO
function check_setting() {
setting_on="false"
INTERFACE=$1
SETTING=$2
if [ -z $INTERFACE ] || [ -z $SETTING ]; then
echo "You didn't call check_setting right, it needs interfaces as \$1 and setting as \$2"
exit 1
fi
if [ $LOGGING == "true" ]; then
ethtool -k $INTERFACE | grep $SETTING | grep ": on"
fi
ethtool -k $INTERFACE | grep $SETTING | grep ": on" > /dev/null
if [ $? == 0 ]; then
setting_on="true"
fi
}
start () {
INTERFACES=$( grep auto /etc/network/interfaces | grep -v lo | awk '{ print $NF }' )
declare -A SETTINGS
SETTINGS=( ["lro"]="large-receive-offload" ["tso"]="tcp-segmentation-offload" ["gso"]="generic-segmentation-offload" ["gro"]="generic-receive-offload" )
ETHTOOL_BIN="/sbin/ethtool"
LOGGING="false"
setting_on="false"
for interface in $INTERFACES; do
for setting in "${!SETTINGS[@]}"; do
check_setting $interface ${SETTINGS[$setting]}
if [ $setting_on == "true" ]; then
$ETHTOOL_BIN -K $interface $setting off
if [ $LOGGING == "true" ]; then
echo "RUNNING: $ETHTOOL_BIN -K $interface $setting off"
fi
fi
done
done
}
case $1 in
start)
start
;;
*)
echo "Usage: $0 {start}" >&2
exit 1
;;
esac
exit 0

View File

@ -99,3 +99,29 @@ if not ["nicira", "plumgrid", "bigswitch"].include?(main_plugin)
notifies :restart, "service[quantum-plugin-openvswitch-agent]", :delayed
end
end
if node['openstack']['network']['disable_offload']
package "ethtool" do
action :install
options platform_options["package_overrides"]
end
service "disable-eth-offload" do
supports :restart => false, :start => true, :stop => false, :reload => false
priority({ 2 => [ :start, 19 ]})
action :nothing
end
# a priority of 19 ensures we start before openvswitch
# at least on ubuntu and debian
cookbook_file "disable-eth-offload-script" do
path "/etc/init.d/disable-eth-offload"
source "disable-eth-offload.sh"
owner "root"
group "root"
mode "0755"
notifies :enable, "service[disable-eth-offload]"
notifies :start, "service[disable-eth-offload]"
end
end