diff options
Diffstat (limited to 'nfvbenchvm/dib/elements')
15 files changed, 183 insertions, 21 deletions
diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/element-deps b/nfvbenchvm/dib/elements/nfvbenchvm/element-deps index c6be0aa..7fd8e5b 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/element-deps +++ b/nfvbenchvm/dib/elements/nfvbenchvm/element-deps @@ -1,4 +1,5 @@ vm +block-device-mbr cloud-init-datasources install-static package-installs diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/fdio-release.repo b/nfvbenchvm/dib/elements/nfvbenchvm/fdio-release.repo index 3ad12fb..6b980c1 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/fdio-release.repo +++ b/nfvbenchvm/dib/elements/nfvbenchvm/fdio-release.repo @@ -1,5 +1,11 @@ [fdio-release] -name=fd.io release branch latest merge -baseurl=https://nexus.fd.io/content/repositories/fd.io.stable.1710.centos7/ -enabled=1 +name=FD.io release 17.10 binary RPM package repository for CentOS 7 +baseurl=https://packagecloud.io/fdio/1710/el/7/$basearch +repo_gpgcheck=1 gpgcheck=0 +enabled=1 +gpgkey=https://packagecloud.io/fdio/1710/gpgkey +sslverify=1 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt +metadata_expire=300 + diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/51-add-cpu-isolation b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/51-add-cpu-isolation index 12ffcdc..e9cf3c5 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/51-add-cpu-isolation +++ b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/51-add-cpu-isolation @@ -1,5 +1,12 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + grubby --update-kernel=ALL --args="isolcpus=1-7 rcu_nocbs=1 nohz=on nohz_full=1 nmi_watchdog=0" grubby --update-kernel=ALL --args="default_hugepagesz=1G hugepagesz=1G hugepages=4" grubby --update-kernel=ALL --args="intel_iommu=on iommu=pt" diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/52-change-resolution b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/52-change-resolution index 26f2f6a..d01b907 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/52-change-resolution +++ b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/52-change-resolution @@ -1,3 +1,10 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + grubby --update-kernel=ALL --args="vga=792" diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/53-boot-from-new-kernel b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/53-boot-from-new-kernel index 6607b0b..e461801 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/53-boot-from-new-kernel +++ b/nfvbenchvm/dib/elements/nfvbenchvm/finalise.d/53-boot-from-new-kernel @@ -1,3 +1,10 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + grubby --set-default-index=0 diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/package-installs.yaml b/nfvbenchvm/dib/elements/nfvbenchvm/package-installs.yaml index 60efec1..6f86027 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/package-installs.yaml +++ b/nfvbenchvm/dib/elements/nfvbenchvm/package-installs.yaml @@ -17,4 +17,5 @@ openssh-server: dpdk-tools: git: python3-dev: -libpython3.6-dev:
\ No newline at end of file +libpython3.6-dev: +python3-pip: diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel index 8094006..0c32b5f 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel @@ -1,5 +1,12 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + if [ $DIB_USE_ELREPO_KERNEL != "True" ]; then exit 0 fi diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package index 9707841..ee7c5f2 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package @@ -1,8 +1,12 @@ #!/bin/bash -cd /tmp -wget https://bootstrap.pypa.io/get-pip.py -python3 get-pip.py +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi -pip3 install setuptools wheel pbr -pip3 install pyyaml +# Stop on error +set -euo pipefail + +python3 -m pip install --upgrade pip +python3 -m pip install setuptools wheel pbr +python3 -m pip install pyyaml diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local index 3311530..4a8e66b 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local @@ -1,8 +1,15 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + # set accurate rc.local file corresponding to current image built if [ $DIB_DEV_IMAGE = "loopvm" ]; then mv /etc/rc.d/rc.local.loopvm /etc/rc.d/rc.local else mv /etc/rc.d/rc.local.generator /etc/rc.d/rc.local -fi
\ No newline at end of file +fi diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute index 666d9dc..52aed8a 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute @@ -1,5 +1,12 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + chmod +x /etc/rc.d/rc.local chmod +x /etc/sysconfig/network-scripts/ifcfg-eth0 chmod +x /etc/profile.d/nfvbench.sh diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script index 9162952..4edc493 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script @@ -1,5 +1,12 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Make sure the disk image build fails if nfvbench installation fails +set -euo pipefail + if [ $DIB_DEV_IMAGE != "generator" ]; then exit 0 fi @@ -17,15 +24,33 @@ rm -rf /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex # NFVbench installation cd /opt -git clone https://gerrit.opnfv.org/gerrit/nfvbench +if [[ "${DIB_NFVBENCH_CODE_ORIGIN}" == "static" ]]; then + # nfvbench code has been copied by the install-static element to + # /opt/nfvbench without the .git/ directory. But pip will need that .git/ + # directory to compute nfvbench version, so will now finish the incomplete + # job of install-static: + STATIC_NFVBENCH_CODE="$(dirname $0)/../static/opt/nfvbench" + [ -d "${STATIC_NFVBENCH_CODE}" ] || { + echo "Error: directory ${STATIC_NFVBENCH_CODE} missing." + echo " You requested a build from local nfvbench code with" + echo " DIB_NFVBENCH_CODE_ORIGIN=static, but you likely forgot" + echo " to clone nfvbench code in elements/nfvbenchvm/static/opt/nfvbench" + exit 1 + } + rsync -lr "${STATIC_NFVBENCH_CODE}"/ /opt/nfvbench/ +else + git clone https://gerrit.opnfv.org/gerrit/nfvbench +fi cd nfvbench/ -pip3 install . --use-deprecated=legacy-resolver +python3 -m pip install . --use-deprecated=legacy-resolver cp xtesting/testcases.yaml /usr/local/lib/python3.6/site-packages/xtesting/ci/testcases.yaml python3 ./docker/cleanup_generators.py rm -rf /opt/nfvbench/.git rm -rf /opt/nfvbench/nfvbench +rm -rf /opt/nfvbench/behave_tests # symlink to NFVbench sources ln -s /usr/local/lib/python3.6/site-packages/nfvbench /opt/nfvbench/nfvbench +ln -s /usr/local/lib/python3.6/site-packages/behave_tests /opt/nfvbench/behave_tests # persist env variables echo "export TREX_VER=\"$TREX_VER\"" >> /etc/profile.d/nfvbench.sh echo "export TREX_EXT_LIBS=\"/opt/trex/$TREX_VER/external_libs\"" >> /etc/profile.d/nfvbench.sh diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script index 64e8877..0c7dfd5 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script @@ -1,4 +1,11 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + # Set UseDNS no value in sshd_config to reduce time to connect -echo "UseDNS no" >> /etc/ssh/sshd_config
\ No newline at end of file +echo "UseDNS no" >> /etc/ssh/sshd_config diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup index e48ca52..dbb7342 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup @@ -1,3 +1,10 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + yum erase -y python-devel libyaml-devel numactl-devel kernel-devel kernel-headers kernel-lt-headers kernel-lt-devel gcc git python3-dev libpython3.6-dev diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator index 633403c..9ac23a3 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator @@ -86,6 +86,24 @@ if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then logger "NFVBENCHVM ERROR: Cannot find eth port for management port" return 1 fi + + # By default, configure the MTU of the management interface to the + # conservative value of 1500: this will reduce the risk to get an + # unmanageable VM in some setups. + # + # To set the MTU to a different value, configure the INTF_MGMT_MTU variable + # in /etc/nfvbenchvm.conf. If INTF_MGMT_MTU is set to the special value + # "auto", the MTU will not be configured and it will keep the value set by + # the hypervisor ("legacy" nfvbenchvm behavior). If INTF_MGMT_MTU is unset, + # the MTU will be set to 1500. In other cases, the MTU will be set to the + # value of INTF_MGMT_MTU. + # + if [[ -z "$INTF_MGMT_MTU" ]]; then + ip link set $ETH_PORT mtu 1500 + elif [[ "$INTF_MGMT_MTU" != "auto" ]]; then + ip link set $ETH_PORT mtu $INTF_MGMT_MTU + fi + ip addr add $INTF_MGMT_CIDR dev $ETH_PORT ip link set $ETH_PORT up ip route add default via $INTF_MGMT_IP_GW dev $ETH_PORT @@ -101,4 +119,4 @@ else /nfvbench/start-nfvbench.sh fi -exit 0
\ No newline at end of file +exit 0 diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm index ecc8b05..181ff2a 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm @@ -137,6 +137,24 @@ if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then else ETH_PORT="eth0" fi + + # By default, configure the MTU of the management interface to the + # conservative value of 1500: this will reduce the risk to get an + # unmanageable VM in some setups. + # + # To set the MTU to a different value, configure the INTF_MGMT_MTU variable + # in /etc/nfvbenchvm.conf. If INTF_MGMT_MTU is set to the special value + # "auto", the MTU will not be configured and it will keep the value set by + # the hypervisor ("legacy" nfvbenchvm behavior). If INTF_MGMT_MTU is unset, + # the MTU will be set to 1500. In other cases, the MTU will be set to the + # value of INTF_MGMT_MTU. + # + if [[ -z "$INTF_MGMT_MTU" ]]; then + ip link set $ETH_PORT mtu 1500 + elif [[ "$INTF_MGMT_MTU" != "auto" ]]; then + ip link set $ETH_PORT mtu $INTF_MGMT_MTU + fi + ip addr add $INTF_MGMT_CIDR dev $ETH_PORT ip link set $ETH_PORT up ip route add default via $INTF_MGMT_IP_GW dev $ETH_PORT @@ -164,6 +182,29 @@ else logger "NFVBENCHVM ERROR: VM MAC Addresses missing in $NFVBENCH_CONF" fi +wait_vpp_service() { + # Wait for at most wait_max=$1 seconds until VPP service is ready. Exit + # with code 1 if timeout is reached. + # + # Because VPP systemd unit has Type=simple, systemctl will report the + # service to be active has soon as it is forked. This does not mean that + # the service is ready, and actually it takes some times before vppctl can + # succesfully connect to VPP client socket /run/vpp/cli.sock. + local wait_max=$1 + + local wait_time=0 + while ! vppctl show int; do + if [[ $wait_time -ge $wait_max ]]; then + # Log error to both system log and standard error output + logger -s "NFVBENCHVM ERROR: VPP service still not ready after $wait_max seconds." \ + "Exiting $(basename $0)." + exit 1 + fi + sleep 1 + wait_time=$(( wait_time + 1 )) + done +} + if [ $PCI_ADDRESS_1 ] && [ $PCI_ADDRESS_2 ]; then logger "NFVBENCHVM: Using pci $PCI_ADDRESS_1 ($INTF_MAC1)" logger "NFVBENCHVM: Using pci $PCI_ADDRESS_2 ($INTF_MAC2)" @@ -205,12 +246,22 @@ if [ $PCI_ADDRESS_1 ] && [ $PCI_ADDRESS_2 ]; then sed -i "s/{{WORKER_CORES}}/$WORKER_CORES/g" /etc/vpp/startup.conf sed -i "s/{{VIF_MQ_SIZE}}/${VIF_MQ_SIZE}/g" /etc/vpp/startup.conf sed -i "s/{{NUM_MBUFS}}/${NUM_MBUFS}/g" /etc/vpp/startup.conf - service vpp start - sleep 10 + systemctl start vpp + # Wait until VPP service is ready for at most 30 seconds + wait_vpp_service 30 - INTFS=`vppctl show int | grep Ethernet | xargs` - INTF_1=`echo $INTFS | awk '{ print $1 }'` - INTF_2=`echo $INTFS | awk '{ print $4 }'` + VPPCTL_OUTPUT=$(vppctl show int) + INTFS=$(echo "$VPPCTL_OUTPUT" | grep Ethernet | xargs) + INTF_1=$(echo $INTFS | awk '{ print $1 }') + INTF_2=$(echo $INTFS | awk '{ print $4 }') + if [[ -z "$INTF_1" ]] || [[ -z "$INTF_2" ]]; then + # Log error to both system log and standard error output + logger -s "NFVBENCHVM DEBUG: \"vppctl show int\" output:" + logger -s "NFVBENCHVM DEBUG: $VPPCTL_OUTPUT" + logger -s "NFVBENCHVM ERROR: vppctl does not show the two Ethernet interfaces we expect." \ + "Exiting $(basename $0)." + exit 1 + fi if [ -z "${TG_MAC1}" ]; then # vm.conf does not support lines commented with #, so # we need to remove the line to set the static ARP entry. @@ -231,7 +282,7 @@ if [ $PCI_ADDRESS_1 ] && [ $PCI_ADDRESS_2 ]; then sed -i "s/{{TG_NET2}}/${TG_NET2//\//\/}/g" /etc/vpp/vm.conf sed -i "s/{{TG_GATEWAY1_IP}}/${TG_GATEWAY1_IP}/g" /etc/vpp/vm.conf sed -i "s/{{TG_GATEWAY2_IP}}/${TG_GATEWAY2_IP}/g" /etc/vpp/vm.conf - service vpp restart + systemctl restart vpp logger "NFVBENCHVM: vpp service restarted" else echo "ERROR: Unknown forwarder value. Accepted values: testpmd or vpp" @@ -244,4 +295,4 @@ else logger "NFVBENCHVM ERROR: Cannot find PCI Address from MAC" fi -exit 0
\ No newline at end of file +exit 0 |