Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I67dc67436bd91feabd735f37dc874bf67e6a4ae8 Partial-Bug: #1743610
- Loading branch information
Showing
16 changed files
with
1,732 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kernel.core_pattern = /var/crashes/core.%e.%p.%h.%t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
ARG CONTRAIL_REGISTRY=localhost:5000 | ||
ARG CONTRAIL_CONTAINER_TAG=4.1.0.0-6-centos7-newton | ||
FROM ${CONTRAIL_REGISTRY}/contrail-base:${CONTRAIL_CONTAINER_TAG} | ||
|
||
RUN yum install -y ethtool pciutils sysvinit-tools \ | ||
contrail-vrouter-dpdk contrail-vrouter-dpdk-init contrail-vrouter-utils \ | ||
sudo python-opencontrail-vrouter-netns python-contrail-vrouter-api && \ | ||
yum clean all && \ | ||
rm -rf /var/cache/yum && \ | ||
ldconfig | ||
|
||
COPY 10-core-pattern.conf /etc/sysctl.d/ | ||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["/usr/bin/contrail-vrouter-dpdk", "--no-daemon", "--socket-mem 1024"] | ||
|
||
LABEL net.juniper.nodemgr.filter.name=contrail-vrouter-agent | ||
LABEL net.juniper.contrail=agent | ||
LABEL net.juniper.node=agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ARG CONTRAIL_REGISTRY=localhost:5000 | ||
ARG CONTRAIL_CONTAINER_TAG=4.1.0.0-6-ubuntu16-newton | ||
FROM ${CONTRAIL_REGISTRY}/contrail-base:${CONTRAIL_CONTAINER_TAG} | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y ethtool pciutils sysvinit-utils \ | ||
contrail-vrouter-dpdk contrail-vrouter-dpdk-init contrail-vrouter-utils \ | ||
sudo python-opencontrail-vrouter-netns python-contrail-vrouter-api && \ | ||
apt-get autoremove && \ | ||
apt-get clean && \ | ||
rm -rf /var/cache/apt && \ | ||
ldconfig | ||
|
||
COPY 10-core-pattern.conf /etc/sysctl.d/ | ||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["/usr/bin/contrail-vrouter-dpdk", "--no-daemon", "--socket-mem 1024"] | ||
|
||
LABEL net.juniper.nodemgr.filter.name=contrail-vrouter-agent | ||
LABEL net.juniper.contrail=agent | ||
LABEL net.juniper.node=agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
source /common.sh | ||
|
||
echo "INFO: agent started in $AGENT_MODE mode" | ||
IFS=' ' read -r phys_int phys_int_mac <<< $(get_physical_nic_and_mac) | ||
pci_address=$(get_pci_address_for_nic $phys_int) | ||
echo "INFO: Physical interface: $phys_int, mac=$phys_int_mac, pci=$pci_address" | ||
|
||
VROUTER_GATEWAY=${VROUTER_GATEWAY:-`get_default_gateway_for_nic $phys_int`} | ||
vrouter_cidr=$(get_cidr_for_nic $phys_int) | ||
echo "INFO: $phys_int cidr $vrouter_cidr, gateway $VROUTER_GATEWAY" | ||
|
||
# TODO: consider to avoid taskset here and leave to manage by Docker | ||
cmd="$@" | ||
real_cmd=$cmd | ||
if [[ -n "$CPU_CORE_MASK" ]] ; then | ||
taskset_param="$CPU_CORE_MASK" | ||
if [[ "${CPU_CORE_MASK}" =~ '[,-]' ]]; then | ||
taskset_param="-c $CPU_CORE_MASK" | ||
fi | ||
if is_ubuntu ; then | ||
real_cmd="/usr/bin/taskset $taskset_param $cmd" | ||
else | ||
real_cmd="/bin/taskset $taskset_param $cmd" | ||
fi | ||
fi | ||
|
||
mkdir -p -m 777 /var/crashes | ||
|
||
# remove rte configuration file (for case if vRouter has crashed) | ||
# TODO: most probably not needed.. since crash means container re-created | ||
rm -f '/run/.rte_config' | ||
|
||
# set maximum socket buffer size to (max hold flows entries * 9160 bytes) | ||
sysctl -w net.core.wmem_max=9160000 | ||
|
||
# bind iface to dpdk uio driver before start dpdk agent | ||
bind_dev_to_driver $DPDK_UIO_DRIVER $phys_int | ||
|
||
function background_init() { | ||
wait_dpdk_agent_start | ||
if [[ -n $cmd ]] ; then | ||
local pname=`echo $cmd | cut -d ' ' -f 1` | ||
enable_hugepages_to_coredump "$pname" | ||
fi | ||
create_vhost0_dpdk $phys_int $phys_int_mac $vrouter_cidr $VROUTER_GATEWAY | ||
} | ||
|
||
# TODO: tart backgound job to enable hugepase to coredump | ||
# and initialize vhost0 | ||
background_init & | ||
|
||
echo "INFO: exec '$real_cmd'" | ||
exec $real_cmd |
13 changes: 13 additions & 0 deletions
13
containers/agent/vrouter-init-kernel-dpdk/Dockerfile.centos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ARG CONTRAIL_REGISTRY=localhost:5000 | ||
ARG CONTRAIL_CONTAINER_TAG=4.1.0.0-6-centos7-newton | ||
FROM ${CONTRAIL_REGISTRY}/contrail-base:${CONTRAIL_CONTAINER_TAG} | ||
|
||
RUN yum clean all -y && \ | ||
rm -rf /var/cache/yum | ||
|
||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
LABEL net.juniper.contrail=vrouter-init-kernel | ||
LABEL net.juniper.node=agent |
16 changes: 16 additions & 0 deletions
16
containers/agent/vrouter-init-kernel-dpdk/Dockerfile.ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ARG CONTRAIL_REGISTRY=localhost:5000 | ||
ARG CONTRAIL_CONTAINER_TAG=4.1.0.0-6-ubuntu16-newton | ||
FROM ${CONTRAIL_REGISTRY}/contrail-base:${CONTRAIL_CONTAINER_TAG} | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y kmod && \ | ||
apt-get autoremove && \ | ||
apt-get clean && \ | ||
rm -rf /var/cache/apt | ||
|
||
COPY entrypoint.sh / | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
LABEL net.juniper.contrail=vrouter-init-kernel | ||
LABEL net.juniper.node=agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash -x | ||
|
||
source /common.sh | ||
|
||
HUGE_PAGES_DIR=${HUGE_PAGES_DIR:-'/dev/hugepages'} | ||
if [[ ! -d "$HUGE_PAGES_DIR" ]] ; then | ||
echo "WARNING: There is no $HUGE_PAGES_DIR mounted from host. Try to create and mount hugetlbfs." | ||
if ! mkdir -p $HUGE_PAGES_DIR ; then | ||
echo "ERROR: failed to create $HUGE_PAGES_DIR" | ||
exit -1 | ||
fi | ||
if ! mount -t hugetlbfs hugetlbfs $HUGE_PAGES_DIR ; then | ||
echo "ERROR: failed to mount hugetlbfs to $HUGE_PAGES_DIR" | ||
exit -1 | ||
fi | ||
fi | ||
|
||
if [[ ! -d "$HUGE_PAGES_DIR" ]] ; then | ||
echo "ERROR: There is no $HUGE_PAGES_DIR. Probably HugeTables are anuvailable on the host." | ||
exit -1 | ||
fi | ||
|
||
function set_ctl() { | ||
local var=$1 | ||
local value=$2 | ||
if grep -q "^$var" /etc/sysctl.conf ; then | ||
sed -i "s/^$var.*=.*/$var=$value/g" /etc/sysctl.conf | ||
else | ||
echo "$var=$value" >> /etc/sysctl.conf | ||
fi | ||
} | ||
|
||
set_ctl vm.nr_hugepages ${HUGE_PAGES} | ||
set_ctl vm.max_map_count 128960 | ||
set_ctl net.ipv4.tcp_keepalive_time 5 | ||
set_ctl net.ipv4.tcp_keepalive_probes 5 | ||
set_ctl net.ipv4.tcp_keepalive_intvl 1 | ||
sysctl --system | ||
|
||
function load_kernel_module() { | ||
local module=$1 | ||
shift 1 | ||
local opts=$@ | ||
echo "INFO: load $module kernel module" | ||
if ! modprobe -v "$module" $opts ; then | ||
echo "ERROR: failed to load $module driver" | ||
exit -1 | ||
fi | ||
} | ||
|
||
function unload_kernel_module() { | ||
local module=$1 | ||
echo "INFO: unload $module kernel module" | ||
if ! rmmod $module ; then | ||
echo "WARNING: Failed to unload $module driver" | ||
fi | ||
} | ||
|
||
load_kernel_module uio | ||
load_kernel_module "$DPDK_UIO_DRIVER" | ||
if ! is_ubuntu_xenial && ! is_centos; then | ||
# multiple kthreads for port monitoring | ||
# TODO: for centos if failes | ||
load_kernel_module rte_kni kthread_mode=multiple | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.