Refactor fuel ovs plugin

Change-Id: I078a1c7472d76041371075c41a1069a3ba248503
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
This commit is contained in:
Guo Ruijing 2016-04-21 07:45:22 +00:00
parent 27eaf16ac1
commit 5e73fe1c11
26 changed files with 129 additions and 382 deletions

View File

@ -7,7 +7,7 @@ Openvswitch plugin
Overview
--------
New fuel plugin fuel-plugin-ovs is developed to deploy OVS with NSH + DPDK in Fuel@OPNFV, which is requested by ODL project
Fuel plugin fuel-plugin-ovs is developed to deploy OVS with NSH + DPDK
Requirements
------------
@ -60,7 +60,7 @@ Openvswitch plugin installation
id | name | version | package_version
---|-----------------|---------|----------------
1 | fuel-plugin-ovs | 0.5.2 | 3.0.0
1 | fuel-plugin-ovs | 0.8.0 | 3.0.0
8. Plugin is ready to use and can be enabled on the Settings tab of the Fuel web UI.
@ -132,4 +132,3 @@ Contributors
------------
* ling.y.yu@intel.com,ruijing.guo@intel.com

View File

@ -1,22 +1,16 @@
$fuel_settings = parseyaml(file('/etc/compute.yaml'))
if $operatingsystem == 'Ubuntu' {
if $fuel_settings['fuel-plugin-ovs']['use_dpdk'] {
$NICS = $fuel_settings['fuel-plugin-ovs']['dpdk-bind-nic']
exec { "install dpdk":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk-install.sh; bash ./dpdk-install.sh $NICS",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
} else {
exec { "install ovs":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/ovs-install.sh; bash ./ovs-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
if $fuel_settings['fuel-plugin-ovs']['use_dppd'] {
exec { "install dppd":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dppd/dppd-install.sh; bash ./dppd-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
if $fuel_settings['fuel-plugin-ovs']['support_dpdk'] {
$packages='openvswitch-datapath-dkms_2.4.90.dpdk-1 openvswitch-common_2.4.90.dpdk-1 openvswitch-switch_2.4.90.dpdk-1'
}
if $fuel_settings['fuel-plugin-ovs']['support_nsh'] {
$packages='openvswitch-datapath-dkms_2.4.90.nsh-1 openvswitch-common_2.4.90.nsh-1 openvswitch-switch_2.4.90.nsh-1'
}
if $fuel_settings['fuel-plugin-ovs']['support_nsh_dpdk'] {
$packages='openvswitch-datapath-dkms_2.4.90.nshdpdk-1 openvswitch-common_2.4.90.nshdpdk-1 openvswitch-switch_2.4.90.nshdpdk-1'
}
exec { 'ovs install':
command => '/usr/bin/apt-get -y --force-yes install $packages'
}
} elsif $operatingsystem == 'CentOS' {
}

View File

@ -1,22 +0,0 @@
$fuel_settings = parseyaml(file('/etc/controller.yaml'))
if $operatingsystem == 'Ubuntu' {
if $fuel_settings['fuel-plugin-ovs']['use_dpdk'] {
$NICS = $fuel_settings['fuel-plugin-ovs']['dpdk-bind-nic']
exec { "install dpdk":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk-install.sh; bash ./dpdk-install.sh $NICS",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
} else {
exec { "install ovs":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/ovs-install.sh; bash ./ovs-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
if $fuel_settings['fuel-plugin-ovs']['use_dppd'] {
exec { "install dppd":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dppd/dppd-install.sh; bash ./dppd-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
} elsif $operatingsystem == 'CentOS' {
}

View File

@ -1,22 +0,0 @@
$fuel_settings = parseyaml(file('/etc/primary-controller.yaml'))
if $operatingsystem == 'Ubuntu' {
if $fuel_settings['fuel-plugin-ovs']['use_dpdk'] {
$NICS = $fuel_settings['fuel-plugin-ovs']['dpdk-bind-nic']
exec { "install dpdk":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk-install.sh; bash ./dpdk-install.sh $NICS",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
} else {
exec { "install ovs":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/ovs-install.sh; bash ./ovs-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
if $fuel_settings['fuel-plugin-ovs']['use_dppd'] {
exec { "install dppd":
command => "wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dppd/dppd-install.sh; bash ./dppd-install.sh",
path => "/usr/bin:/usr/sbin:/bin:/sbin",
}
}
} elsif $operatingsystem == 'CentOS' {
}

View File

@ -1,16 +1,16 @@
attributes:
use_dpdk:
support_dpdk:
type: "checkbox"
weight: 20
value: false
label: "Use dpdk"
dpdk-bind-nic:
value: 'eth2'
label: 'Network device'
weight: 40
type: "text"
use_dppd:
label: "support DPDK"
support_nsh:
type: "checkbox"
weight: 20
value: false
label: "Use dppd"
label: "support NSH"
support_nsh_dpdk:
type: "checkbox"
weight: 20
value: false
label: "support NSH & DPDK"

View File

@ -1,9 +1,9 @@
# Plugin name
name: fuel-plugin-ovs
# Human-readable name for your plugin
title: Openvswitch with NSH support
title: Openvswitch with NSH/DPDK support
# Plugin version
version: '0.5.2'
version: '0.8.0'
# Description
description: 'This plugin provides to deploy openvswitch with nsh'
# Required fuel version

View File

@ -1,27 +0,0 @@
#!/bin/bash
FROM ubuntu:14.04.3
RUN rm -rf /lib/modules
RUN apt-get update
RUN apt-get install -y software-properties-common python-software-properties \
make python-setuptools python-all dpkg-dev debhelper \
fuseiso git genisoimage bind9-host wget curl lintian tmux lxc iptables \
ca-certificates sudo apt-utils lsb-release libtool autoconf automake build-essential fakeroot libssl-dev graphviz dh-autoreconf python-qt4 python-twisted-conch python-zopeinterface linux-headers-3.13.0-76-generic
RUN ln -s /lib/modules/3.13.0-76-generic /lib/modules/`uname -r`
RUN apt-get install -y pkg-config unzip liblua5.2-dev libpcap-dev libedit-dev libncurses5-dev libncursesw5-dev
RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo
RUN chmod 0440 /etc/sudoers.d/open-sudo
ADD ./patches /patches
ADD ./build-ovs-nsh.sh /build-ovs-nsh.sh
RUN chmod +x /build-ovs-nsh.sh
RUN /build-ovs-nsh.sh
ADD ./build-ovs-nsh-dpdk.sh /build-ovs-nsh-dpdk.sh
RUN chmod +x /build-ovs-nsh-dpdk.sh
RUN /build-ovs-nsh-dpdk.sh

View File

@ -1,50 +0,0 @@
#!/bin/bash
DPDK_VER=2.1.0
OVS_COMMIT=121daded51b9798fe3722824b27a05c16806cbd1
RTE_TARGET=x86_64-native-linuxapp-gcc
PATCHES="060679 060680 060681 060682 060683 060684 060685"
URL_OVS=https://github.com/openvswitch/ovs.git
URL_DPDK=http://dpdk.org/browse/dpdk/snapshot/dpdk-${DPDK_VER}.tar.gz
wget ${URL_DPDK}
tar -xzvf dpdk-${DPDK_VER}.tar.gz
cd dpdk-${DPDK_VER}
sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST=n/CONFIG_RTE_LIBRTE_VHOST=y/' \
-e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/' \
-e 's/CONFIG_RTE_PKTMBUF_HEADROOM=128/CONFIG_RTE_PKTMBUF_HEADROOM=256/' \
config/common_linuxapp
cd /
tar -czvf dpdk-${DPDK_VER}.tar.gz dpdk-${DPDK_VER}
cd dpdk-${DPDK_VER}
make install T=${RTE_TARGET}
find . | grep "\.o$" | xargs rm -rf
cd /
tar czvf dpdk-${DPDK_VER}.bin.tar.gz dpdk-${DPDK_VER}
git clone ${URL_OVS} openvswitch-dpdk
cd openvswitch-dpdk
git checkout ${OVS_COMMIT} -b development
for patch in ${PATCHES}
do
patch -p1 < /patches/${patch}.patch
done
export RTE_SDK=/dpdk-${DPDK_VER}
export DPDK_BUILD=${RTE_SDK}/${RTE_TARGET}
./boot.sh
./configure --with-dpdk=$DPDK_BUILD
sed -i "s?set ovs-vswitchd unix?set ovs-vswitchd --dpdk -c 0x1 -n 4 -- unix?" utilities/ovs-ctl.in;sed -i "s?configure --with-linux?configure --with-dpdk=/dpdk-2.1.0/x86_64-native-linuxapp-gcc --with-linux?" debian/dkms.conf.in;sed -i "s?configure --with-linux?configure --with-dpdk=/dpdk-2.1.0/x86_64-native-linuxapp-gcc --with-linux?" debian/rules.modules;sed -i "s?configure --?configure -- --with-dpdk=/dpdk-2.1.0/x86_64-native-linuxapp-gcc?" debian/rules;make dist;tar -xzf openvswitch-2.4.90.tar.gz;
cd openvswitch-2.4.90;DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
cd /
wget https://01.org/sites/default/files/downloads/intel-data-plane-performance-demonstrators/dppd-prox-v021.zip
unzip dppd-prox-v021.zip
export RTE_SDK=/dpdk-${DPDK_VER}
export RTE_TARGET=x86_64-native-linuxapp-gcc
cd /dppd-PROX-v021
export DPPD_DIR=`pwd`; make
find . | grep "\.o$" | xargs rm -rf
cd /
tar czvf dppd-prox-v021.bin.tar.gz dppd-PROX-v021

14
ovs_build/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
FROM ubuntu:14.04.3
RUN apt-get update -y
RUN rm -rf /lib/modules
RUN apt-get install -y linux-headers-3.13.0-76-generic
RUN ln -s /lib/modules/3.13.0-76-generic /lib/modules/`uname -r`
RUN apt-get build-dep openvswitch -y
RUN apt-get -y install devscripts dpkg-dev git wget
ADD ./ /ovs_build

37
ovs_build/build-ovs-dpdk.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
DPDK_VER=2.1.0
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=/dpdk-${DPDK_VER}
export DPDK_BUILD=${RTE_SDK}/${RTE_TARGET}
OVS_COMMIT=121daded51b9798fe3722824b27a05c16806cbd1
URL_OVS=https://github.com/openvswitch/ovs.git
URL_DPDK=http://dpdk.org/browse/dpdk/snapshot/dpdk-${DPDK_VER}.tar.gz
cd /
wget ${URL_DPDK}
tar -xzvf dpdk-${DPDK_VER}.tar.gz
cd dpdk-${DPDK_VER}
sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST=n/CONFIG_RTE_LIBRTE_VHOST=y/' \
-e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/' \
-e 's/CONFIG_RTE_PKTMBUF_HEADROOM=128/CONFIG_RTE_PKTMBUF_HEADROOM=256/' \
config/common_linuxapp
make install T=${RTE_TARGET}
cd /
git clone ${URL_OVS} openvswitch
cd openvswitch
git checkout ${OVS_COMMIT} -b development
export DEB_BUILD_OPTIONS='parallel=8 nocheck'
sed -i "s/2.4.90/2.4.90.dpdk/g" debian/changelog
sed -i "s/DATAPATH_CONFIGURE_OPTS.*=.*//" debian/rules
sed -i "2iDATAPATH_CONFIGURE_OPTS='--with-dpdk=$DPDK_BUILD'" debian/rules
sed -i "s/DATAPATH_CONFIGURE_OPTS.*=.*//" debian/rules.modules
sed -i "2iDATAPATH_CONFIGURE_OPTS='--with-dpdk=$DPDK_BUILD'" debian/rules.modules
debian/rules build
fakeroot debian/rules binary
cp /*.deb /build

41
ovs_build/build-ovs-nsh-dpdk.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
DPDK_VER=2.1.0
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=/dpdk-${DPDK_VER}
export DPDK_BUILD=${RTE_SDK}/${RTE_TARGET}
OVS_COMMIT=121daded51b9798fe3722824b27a05c16806cbd1
PATCHES="060679 060680 060681 060682 060683 060684 060685"
URL_OVS=https://github.com/openvswitch/ovs.git
URL_DPDK=http://dpdk.org/browse/dpdk/snapshot/dpdk-${DPDK_VER}.tar.gz
cd /
wget ${URL_DPDK}
tar -xzvf dpdk-${DPDK_VER}.tar.gz
cd dpdk-${DPDK_VER}
sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST=n/CONFIG_RTE_LIBRTE_VHOST=y/' \
-e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/' \
-e 's/CONFIG_RTE_PKTMBUF_HEADROOM=128/CONFIG_RTE_PKTMBUF_HEADROOM=256/' \
config/common_linuxapp
make install T=${RTE_TARGET}
cd /
git clone ${URL_OVS} openvswitch
cd openvswitch
git checkout ${OVS_COMMIT} -b development
for patch in ${PATCHES}
do
patch -p1 < /ovs_build/patches/${patch}.patch
done
export DEB_BUILD_OPTIONS='parallel=8 nocheck'
sed -i "s/2.4.90/2.4.90.nshdpdk/g" debian/changelog
sed -i "s/DATAPATH_CONFIGURE_OPTS.*=.*//" debian/rules
sed -i "2iDATAPATH_CONFIGURE_OPTS='--with-dpdk=$DPDK_BUILD'" debian/rules
sed -i "s/DATAPATH_CONFIGURE_OPTS.*=.*//" debian/rules.modules
sed -i "2iDATAPATH_CONFIGURE_OPTS='--with-dpdk=$DPDK_BUILD'" debian/rules.modules
debian/rules build
fakeroot debian/rules binary
cp /*.deb /build

View File

@ -4,13 +4,17 @@ OVS_COMMIT=121daded51b9798fe3722824b27a05c16806cbd1
PATCHES="060679 060680 060681 060682 060683 060684 060685"
URL_OVS=https://github.com/openvswitch/ovs.git
cd /
git clone ${URL_OVS} openvswitch
cd openvswitch
git checkout ${OVS_COMMIT} -b development
for patch in ${PATCHES}
do
patch -p1 < /patches/${patch}.patch
patch -p1 < /ovs_build/patches/${patch}.patch
done
./boot.sh;./configure;make dist;tar -xzf openvswitch-2.4.90.tar.gz
cd openvswitch-2.4.90;dpkg-checkbuilddeps;DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
export DEB_BUILD_OPTIONS='parallel=8 nocheck'
sed -i "s/2.4.90/2.4.90.nsh/g" debian/changelog
debian/rules build
fakeroot debian/rules binary
cp /*.deb /build

View File

@ -20,18 +20,11 @@ function build_pkg {
pushd "${DIR}/repositories/${1}/"
download_dependencies ${1}
popd
cd ${DIR}/ovs-nsh
sudo docker build -t ovs-nsh .
container_id=`sudo docker run -d ovs-nsh`
sudo docker cp $container_id:/openvswitch/openvswitch-common_2.4.90-1_amd64.deb ${DIR}/repositories/ubuntu/ovs/
sudo docker cp $container_id:/openvswitch/openvswitch-datapath-dkms_2.4.90-1_all.deb ${DIR}/repositories/ubuntu/ovs/
sudo docker cp $container_id:/openvswitch/openvswitch-switch_2.4.90-1_amd64.deb ${DIR}/repositories/ubuntu/ovs/
sudo docker cp $container_id:/openvswitch-dpdk/openvswitch-common_2.4.90-1_amd64.deb ${DIR}/repositories/ubuntu/dpdk
sudo docker cp $container_id:/openvswitch-dpdk/openvswitch-datapath-dkms_2.4.90-1_all.deb ${DIR}/repositories/ubuntu/dpdk
sudo docker cp $container_id:/openvswitch-dpdk/openvswitch-switch_2.4.90-1_amd64.deb ${DIR}/repositories/ubuntu/dpdk
sudo docker cp $container_id:/dpdk-2.1.0.bin.tar.gz ${DIR}/repositories/ubuntu/dpdk/
sudo docker cp $container_id:/dppd-prox-v021.bin.tar.gz ${DIR}/repositories/ubuntu/dppd/
cd ${DIR}/ovs_build
sudo docker build -t ovs_build .
sudo docker run -v ${DIR}/repositories/ubuntu/ovs-nsh:/build -ti ovs_build /ovs_build/build-ovs-nsh.sh
sudo docker run -v ${DIR}/repositories/ubuntu/ovs-dpdk:/build -ti ovs_build /ovs_build/build-ovs-dpdk.sh
sudo docker run -v ${DIR}/repositories/ubuntu/ovs-nsh-dpdk:/build -ti ovs_build /ovs_build/build-ovs-nsh-dpdk.sh
;;
*) echo "Not supported system"; exit 1;;
esac

View File

@ -1,24 +0,0 @@
#!/bin/bash
NICS=$1
INSTALL_HOME=/usr/share/dpdk/
rm -rf $INSTALL_HOME ; mkdir -p $INSTALL_HOME
cd $INSTALL_HOME
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk-2.1.0.bin.tar.gz
tar xzvf dpdk-2.1.0.bin.tar.gz
rm -rf dpdk-2.1.0.bin.tar.gz
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk.init -O /etc/init.d/dpdk
chmod +x /etc/init.d/dpdk
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/dpdk.conf -O /etc/default/dpdk.conf
sed "s/DPDK_NIC_MAPPINGS=.*/DPDK_NIC_MAPPINGS=${NICS}/" -i /etc/default/dpdk.conf
service dpdk start
INSTALL_HOME=/usr/share/ovs-dpdk/
rm -rf $INSTALL_HOME ; mkdir -p $INSTALL_HOME
cd $INSTALL_HOME
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/openvswitch-datapath-dkms_2.4.90-1_all.deb
dpkg -i openvswitch-datapath-dkms_2.4.90-1_all.deb
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/openvswitch-common_2.4.90-1_amd64.deb
dpkg -i openvswitch-common_2.4.90-1_amd64.deb
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dpdk/openvswitch-switch_2.4.90-1_amd64.deb
dpkg -i openvswitch-switch_2.4.90-1_amd64.deb

View File

@ -1,6 +0,0 @@
DPDK_NUM_HUGEPAGES=${DPDK_NUM_HUGEPAGES:-2048}
DPDK_HUGEPAGE_MOUNT=${DPDK_HUGEPAGE_MOUNT:-/dev/hugepages}
DPDK_NIC_MAPPINGS=eth1
DPDK_ALLOCATE_HUGEPAGES=True
DPDK_INTERFACE_DRIVER='igb_uio'
DPDK_HUGEPAGE_MOUNT_PAGESIZE=''

View File

@ -1,147 +0,0 @@
#! /bin/bash
#
# Copyright (C) 2015 Intel, 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.
#
echo "sourcing config"
source /etc/default/dpdk.conf
RTE_SDK=${RTE_SDK:-/usr/share/dpdk/dpdk-2.1.0}
RTE_TARGET=${RTE_TARGET:-x86_64-native-linuxapp-gcc}
DPDK_DIR=$RTE_SDK
remove_igb_uio_module(){
sudo rmmod igb_uio
}
unbind_nics(){
NICS=`RTE_SDK=${DPDK_DIR} RTE_TARGET=build ${DPDK_DIR}/tools/dpdk_nic_bind.py --status | grep drv=igb_uio | head -1`
while [ "${NICS}" != "" ]
do
BUSID=`echo "${NICS}" | awk '{ print $1 }'`
NANTIC=`echo "${NICS}" | grep "82574L"`
FVL=`echo "${NICS}" | grep "X710"`
RRC=`echo "${NICS}" | grep "82576"`
EM=`echo "${NICS}" | grep "82540EM"`
if [ "${NANTIC}" != "" ] ;then
DRIVER=e1000e
elif [ "${FVL}" != "" ] ;then
DRIVER=i40e
elif [ "${RRC}" != "" ] ;then
DRIVER=igb
elif [ "${EM}" != "" ] ;then
DRIVER=e1000
else
DRIVER=ixgbe
fi
sudo RTE_SDK=${DPDK_DIR} RTE_TARGET=build ${DPDK_DIR}/tools/dpdk_nic_bind.py -b ${DRIVER} ${BUSID}
NICS=`RTE_SDK=${DPDK_DIR} RTE_TARGET=build ${DPDK_DIR}/tools/dpdk_nic_bind.py --status | grep drv=igb_uio | head -1`
done
}
free_hugepages() {
HUGEPAGE_SIZE=$(grep Hugepagesize /proc/meminfo | awk '{ print $2 }')
if [ -d $DPDK_HUGEPAGE_MOUNT ]; then
sudo rm -rf ${DPDK_HUGEPAGE_MOUNT}/rtemap*
fi
sudo umount ${DPDK_HUGEPAGE_MOUNT}
# de-allocate hugepages
if [ $DPDK_ALLOCATE_HUGEPAGES == 'True' ]; then
for d in /sys/devices/system/node/node? ; do
echo 0 | sudo tee $d/hugepages/hugepages-${HUGEPAGE_SIZE}kB/nr_hugepages
done
fi
}
load_igb_uio_module(){
if [ ! -f $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko ];then
echo "## ERROR: Target does not have the DPDK UIO Kernel Module."
echo " To fix, please try to rebuild target."
return
fi
sudo modprobe uio
echo "Loading DPDK UIO module"
sudo insmod $RTE_SDK/$RTE_TARGET/kmod/igb_uio.ko
}
bind_nic_2_driver() {
list=("$@")
# Bind nics to DPDK_INTERFACE_DRIVER.
for pair in "${list[@]}"; do
addr=`echo $pair | cut -f 1 -d "#"`
nic=`echo $pair | cut -f 2 -d "#"`
echo sudo RTE_SDK=${DPDK_DIR} RTE_TARGET=build ${DPDK_DIR}/tools/dpdk_nic_bind.py -b $DPDK_INTERFACE_DRIVER $addr
sudo RTE_SDK=${DPDK_DIR} RTE_TARGET=build ${DPDK_DIR}/tools/dpdk_nic_bind.py -b $DPDK_INTERFACE_DRIVER $addr
done
}
bind_nics(){
# Extract nic name, bind it with DPDK_INTERFACE_DRIVER driver
PCI_MAPPINGS=${DPDK_NIC_MAPPINGS//,/ }
PCI_ARRAY=( $PCI_MAPPINGS )
bind_nic_2_driver "${PCI_ARRAY[@]}"
}
alloc_hugepages() {
HUGEPAGE_SIZE=$(grep Hugepagesize /proc/meminfo | awk '{ print $2 }')
sudo mkdir -p $DPDK_HUGEPAGE_MOUNT
#allocate hugepages
if [ $DPDK_ALLOCATE_HUGEPAGES == 'True' ]; then
for d in /sys/devices/system/node/node? ; do
echo $DPDK_NUM_HUGEPAGES | sudo tee $d/hugepages/hugepages-${HUGEPAGE_SIZE}kB/nr_hugepages
done
fi
if [ -n "$DPDK_HUGEPAGE_MOUNT_PAGESIZE" ]; then
sudo mount -t hugetlbfs pagesize=$DPDK_HUGEPAGE_MOUNT_PAGESIZE nodev $DPDK_HUGEPAGE_MOUNT
else
sudo mount -t hugetlbfs nodev $DPDK_HUGEPAGE_MOUNT
fi
}
cmd_start(){
echo "mounting hugepages"
alloc_hugepages
echo "loading DPDK_INTERFACE_DRIVER diver"
load_igb_uio_module
bind_nics
}
cmd_stop(){
#if physical nics bindings are defined, bind nics with linux driver
echo "rebinding nics to linux_driver"
unbind_nics
remove_igb_uio_module
echo "unmounting hugepages"
free_hugepages
}
case "$1" in
start)
cmd_start
;;
stop)
cmd_stop
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 1
;;
esac
exit 0

View File

@ -1,9 +0,0 @@
#!/bin/bash
set -eux
INSTALL_HOME=/usr/share/dppd/
rm -rf $INSTALL_HOME ; mkdir -p $INSTALL_HOME
cd $INSTALL_HOME
apt-get install -y pkg-config liblua5.2-dev libpcap-dev libedit-dev libncurses5-dev libncursesw5-dev
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/dppd/dppd-prox-v021.bin.tar.gz
tar xzvf dppd-prox-v021.bin.tar.gz
rm -rf dppd-prox-v021.bin.tar.gz

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -eux
INSTALL_HOME=/usr/share/ovs/
rm -rf $INSTALL_HOME ; mkdir -p $INSTALL_HOME
cd $INSTALL_HOME
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/openvswitch-datapath-dkms_2.4.90-1_all.deb
dpkg -i openvswitch-datapath-dkms_2.4.90-1_all.deb
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/openvswitch-common_2.4.90-1_amd64.deb
dpkg -i openvswitch-common_2.4.90-1_amd64.deb
wget http://10.20.0.2:8080/plugins/fuel-plugin-ovs-0.5/repositories/ubuntu/ovs/openvswitch-switch_2.4.90-1_amd64.deb
dpkg -i openvswitch-switch_2.4.90-1_amd64.deb

View File

@ -1,19 +1,3 @@
- id: ovs_install_primary_controller
role: ['primary-controller']
stage: pre_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/ovs-install-primary-controller.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: ovs_install_controller
role: ['controller']
stage: pre_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/ovs-install-controller.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: ovs_install_compute
role: ['compute']
stage: pre_deployment