- initd config for Open vSwitch with DPDK
openvswitch-with-dpdk provides the userspace switch in place of the Open vSwitch kernel-based switch.
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: ovs-dpdk
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: Open vSwitch with DPDK support
# Description: openvswitch-with-dpdk provides the userspace switch
# in place of the Open vSwitch kernel-based switch.
### END INIT INFO
PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/share/openvswitch/scripts
start () {
# set ovs_ctl ${1-start} --system-id=random
# if test X"$FORCE_COREFILES" != X; then
# set "$@" --force-corefiles="$FORCE_COREFILES"
# fi
# set "$@" $OVS_CTL_OPTS
# "$@" || exit $?
#
iptables -A INPUT -i eth0 -j DROP
iptables -A FORWARD -i eth0 -j DROP
dpdk_nic_bind -b uio_pci_generic eth2
dpdk_nic_bind -b uio_pci_generic eth3
mkdir -p /var/run/openvswitch
ovsdb-server --remote=punix:/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--pidfile --detach
#killall ovs-vswitchd
ovs-vswitchd --dpdk -c 8 -n 4 --socket-mem 1024,0 \
-- unix:/var/run/openvswitch/db.sock --pidfile --detach
nohup networking-ovs-dpdk-agent --nodebug --log-dir /var/log/neutron \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini > /dev/null &
/usr/sbin/service neutron-l3-agent restart
/usr/sbin/service neutron-dhcp-agent restart
/usr/sbin/service neutron-server restart
echo 1 > /proc/irq/default_smp_affinity
echo 0 > /sys/kernel/mm/ksm/run
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 0 > /proc/sys/kernel/nmi_watchdog
/etc/init.d/ondemand stop
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
service irqbalance stop
}
stop () {
# ovs_ctl stop
killall ovs-vswitchd
# dpdk_nic_bind -b igb eth2
# dpdk_nic_bind -b igb eth3
}
restart () {
# start restart
killall ovs-vswitchd
ovs-vswitchd --dpdk -c 8 -n 4 --socket-mem 1024,0 \
-- unix:/var/run/openvswitch/db.sock --pidfile --detach
/usr/sbin/service neutron-l3-agent restart
/usr/sbin/service neutron-dhcp-agent restart
/usr/sbin/service neutron-server restart
# ovs-ctl restart
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
shift
restart "$@"
;;
status)
ovs_ctl status
exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0