summaryrefslogtreecommitdiffstats
path: root/rapidvm/dib/elements
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@intel.com>2021-02-15 15:01:20 +0100
committerLuc Provoost <luc.provoost@intel.com>2021-02-18 14:38:16 +0100
commit480fcf799c1c30421e10abb78b91303ade4bc059 (patch)
treef314b637e94ccca6c49cbb59c1c4f5d76886d9b4 /rapidvm/dib/elements
parent849357bb9ca1d27993c9e96b93156ec69b3ac3a9 (diff)
Using disk image builder to create rapid VM
All files are now availavle to build a qcow2 image using disk image builder. This image is based on centos 7. DPDK and PROX are installed together with some optimizations. Change-Id: I61aa91206ea7f8b3b6a3ff7d490d1804e7e784c8 Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'rapidvm/dib/elements')
-rw-r--r--rapidvm/dib/elements/rapid/element-deps5
-rw-r--r--rapidvm/dib/elements/rapid/package-installs.yaml20
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/40-mlib30
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/50-compile-dpdk36
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/60-compile-prox27
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/70-os-cfg50
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/80-change-permissions18
-rwxr-xr-xrapidvm/dib/elements/rapid/post-install.d/81-clean-rpms20
-rw-r--r--rapidvm/dib/elements/rapid/source-repository-dpdk1
-rw-r--r--rapidvm/dib/elements/rapid/source-repository-samplevnf1
10 files changed, 208 insertions, 0 deletions
diff --git a/rapidvm/dib/elements/rapid/element-deps b/rapidvm/dib/elements/rapid/element-deps
new file mode 100644
index 00000000..c6be0aa3
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/element-deps
@@ -0,0 +1,5 @@
+vm
+cloud-init-datasources
+install-static
+package-installs
+devuser
diff --git a/rapidvm/dib/elements/rapid/package-installs.yaml b/rapidvm/dib/elements/rapid/package-installs.yaml
new file mode 100644
index 00000000..8b3a3cf3
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/package-installs.yaml
@@ -0,0 +1,20 @@
+deltarpm:
+yum-utils:
+git:
+wget:
+gcc:
+unzip:
+libpcap-devel:
+ncurses-devel:
+libedit-devel:
+lua-devel:
+kernel-devel:
+iperf3:
+pciutils:
+numactl-devel:
+vim:
+tuna:
+openssl-devel:
+wireshark:
+make:
+driverctl:
diff --git a/rapidvm/dib/elements/rapid/post-install.d/40-mlib b/rapidvm/dib/elements/rapid/post-install.d/40-mlib
new file mode 100755
index 00000000..34dc1b9c
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/40-mlib
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+MULTI_BUFFER_LIB_VER="0.52"
+BUILD_DIR="/opt/rapid"
+export AESNI_MULTI_BUFFER_LIB_PATH="${BUILD_DIR}/intel-ipsec-mb-${MULTI_BUFFER_LIB_VER}"
+# Downloading the Multi-buffer library. Note that the version to download is linked to the DPDK version being used
+pushd ${BUILD_DIR} > /dev/null 2>&1
+wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/linux/nasm-2.14.02-0.fc27.x86_64.rpm
+rpm -ivh nasm-2.14.02-0.fc27.x86_64.rpm
+wget https://github.com/01org/intel-ipsec-mb/archive/v${MULTI_BUFFER_LIB_VER}.zip
+unzip v${MULTI_BUFFER_LIB_VER}.zip
+pushd ${AESNI_MULTI_BUFFER_LIB_PATH}
+make -j`getconf _NPROCESSORS_ONLN`
+make install
+popd > /dev/null 2>&1
+popd > /dev/null 2>&1
diff --git a/rapidvm/dib/elements/rapid/post-install.d/50-compile-dpdk b/rapidvm/dib/elements/rapid/post-install.d/50-compile-dpdk
new file mode 100755
index 00000000..38d07486
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/50-compile-dpdk
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+# pick up the kernel version for the target image
+BUILD_DIR="/opt/rapid"
+export RTE_SDK="${BUILD_DIR}/dpdk"
+export RTE_TARGET="x86_64-native-linuxapp-gcc"
+
+LATEST_KERNEL_INSTALLED=`ls -v1 /lib/modules/ | tail -1`
+export RTE_KERNELDIR="/lib/modules/${LATEST_KERNEL_INSTALLED}/build"
+
+pushd ${RTE_SDK} > /dev/null 2>&1
+make config T=${RTE_TARGET}
+#sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' ${RTE_SDK}/build/.config
+#sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y/g' ${RTE_SDK}/build/.config
+sed -i 's/CONFIG_RTE_APP_TEST=y/CONFIG_RTE_APP_TEST=n/g' ${RTE_SDK}/build/.config
+sed -i 's/CONFIG_RTE_TEST_PMD=y/CONFIG_RTE_TEST_PMD=n/g' ${RTE_SDK}/build/.config
+sed -i 's/CONFIG_RTE_TEST_BBDEV=y/CONFIG_RTE_TEST_BBDEV=n/g' ${RTE_SDK}/build/.config
+sed -i 's/CONFIG_RTE_APP_COMPRESS_PERF=y/CONFIG_RTE_APP_COMPRESS_PERF=n/g' ${RTE_SDK}/build/.config
+sed -i 's/CONFIG_RTE_APP_CRYPTO_PERF=y/CONFIG_RTE_APP_CRYPTO_PERF=n/g' ${RTE_SDK}/build/.config
+#sed -i 's/CONFIG_RTE_APP_EVENTDEV=y/CONFIG_RTE_APP_EVENTDEV=n/g' ${RTE_SDK}/build/.config
+make -j`getconf _NPROCESSORS_ONLN`
+popd > /dev/null 2>&1
diff --git a/rapidvm/dib/elements/rapid/post-install.d/60-compile-prox b/rapidvm/dib/elements/rapid/post-install.d/60-compile-prox
new file mode 100755
index 00000000..2ae1c3cb
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/60-compile-prox
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+BUILD_DIR="/opt/rapid"
+export RTE_SDK="${BUILD_DIR}/dpdk"
+export RTE_TARGET="build"
+pushd ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX > /dev/null 2>&1
+make -j`getconf _NPROCESSORS_ONLN`
+cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/build/app/prox ${BUILD_DIR}/prox
+cp helper-scripts/rapid/check_prox_system_setup.sh ${BUILD_DIR}
+cp helper-scripts/rapid/check-prox-system-setup.service ${BUILD_DIR}
+cp helper-scripts/rapid/sharkproxlog.sh ${BUILD_DIR}
+cp helper-scripts/rapid/deploycentostools.sh ${BUILD_DIR}
+popd > /dev/null 2>&1
diff --git a/rapidvm/dib/elements/rapid/post-install.d/70-os-cfg b/rapidvm/dib/elements/rapid/post-install.d/70-os-cfg
new file mode 100755
index 00000000..64bbad5a
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/70-os-cfg
@@ -0,0 +1,50 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+BUILD_DIR="/opt/rapid"
+# huge pages to be used by DPDK
+sh -c '(echo "vm.nr_hugepages = 1024") > /etc/sysctl.conf'
+
+sh -c '(echo "options vfio enable_unsafe_noiommu_mode=1") > /etc/modprobe.d/vfio.conf'
+sh -c '(echo "vfio") > /etc/modules-load.d/vfio.conf'
+sh -c '(echo "vfio-pci") > /etc/modules-load.d/vfio.conf'
+# Enabling tuned with the realtime-virtual-guest profile
+pushd ${BUILD_DIR} > /dev/null 2>&1
+#wget http://linuxsoft.cern.ch/cern/centos/7/rt/x86_64/Packages/tuned-profiles-realtime-2.8.0-5.el7_4.2.noarch.rpm
+wget http://linuxsoft.cern.ch/cern/centos/7/rt/x86_64/Packages/tuned-profiles-realtime-2.9.0-1.el7_5.2.noarch.rpm
+#wget http://linuxsoft.cern.ch/cern/centos/7/rt/x86_64/Packages/tuned-profiles-nfv-guest-2.8.0-5.el7_4.2.noarch.rpm
+wget http://linuxsoft.cern.ch/cern/centos/7/rt/x86_64/Packages/tuned-profiles-nfv-guest-2.9.0-1.el7_5.2.noarch.rpm
+# Install with --nodeps. The latest CentOS cloud images come with a tuned version higher than 2.8. These 2 packages however
+# do not depend on v2.8 and also work with tuned 2.9. Need to be careful in the future
+#rpm -ivh ${BUILD_DIR}/tuned-profiles-realtime-2.8.0-5.el7_4.2.noarch.rpm --nodeps
+#rpm -ivh ${BUILD_DIR}/tuned-profiles-nfv-guest-2.8.0-5.el7_4.2.noarch.rpm --nodeps
+rpm -ivh ${BUILD_DIR}/tuned-profiles-realtime-2.9.0-1.el7_5.2.noarch.rpm --nodeps
+rpm -ivh ${BUILD_DIR}/tuned-profiles-nfv-guest-2.9.0-1.el7_5.2.noarch.rpm --nodeps
+# Although we do no know how many cores the VM will have when begin deployed for real testing, we already put a number for the
+# isolated CPUs so we can start the realtime-virtual-guest profile. If we don't, that command will fail.
+# When the VM will be instantiated, the check_kernel_params service will check for the real number of cores available to this VM
+# and update the realtime-virtual-guest-variables.conf accordingly.
+echo "isolated_cores=1-3" | tee -a /etc/tuned/realtime-virtual-guest-variables.conf
+tuned-adm profile realtime-virtual-guest
+
+# Install the check_tuned_params service to make sure that the grub cmd line has the right cpus in isolcpu. The actual number of cpu's
+# assigned to this VM depends on the flavor used. We don't know at this time what that will be.
+chmod +x ${BUILD_DIR}/check_prox_system_setup.sh
+mv ${BUILD_DIR}/check_prox_system_setup.sh /usr/local/libexec/
+mv ${BUILD_DIR}/check-prox-system-setup.service /etc/systemd/system/
+systemctl daemon-reload
+systemctl enable check-prox-system-setup.service
+popd > /dev/null 2>&1
diff --git a/rapidvm/dib/elements/rapid/post-install.d/80-change-permissions b/rapidvm/dib/elements/rapid/post-install.d/80-change-permissions
new file mode 100755
index 00000000..86368431
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/80-change-permissions
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+BUILD_DIR="/opt/rapid"
+chmod ugo+rwx ${BUILD_DIR}
diff --git a/rapidvm/dib/elements/rapid/post-install.d/81-clean-rpms b/rapidvm/dib/elements/rapid/post-install.d/81-clean-rpms
new file mode 100755
index 00000000..0fc166e3
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/post-install.d/81-clean-rpms
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2021 Intel Corporation
+#
+# 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.
+#
+BUILD_DIR="/opt/rapid"
+rm ${BUILD_DIR}/tuned-profiles-realtime-2.9.0-1.el7_5.2.noarch.rpm
+rm ${BUILD_DIR}/tuned-profiles-nfv-guest-2.9.0-1.el7_5.2.noarch.rpm
+rm ${BUILD_DIR}/nasm-2.14.02-0.fc27.x86_64.rpm
diff --git a/rapidvm/dib/elements/rapid/source-repository-dpdk b/rapidvm/dib/elements/rapid/source-repository-dpdk
new file mode 100644
index 00000000..ce19a904
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/source-repository-dpdk
@@ -0,0 +1 @@
+dpdk tar /opt/rapid/dpdk http://fast.dpdk.org/rel/dpdk-20.05.tar.gz *
diff --git a/rapidvm/dib/elements/rapid/source-repository-samplevnf b/rapidvm/dib/elements/rapid/source-repository-samplevnf
new file mode 100644
index 00000000..80331875
--- /dev/null
+++ b/rapidvm/dib/elements/rapid/source-repository-samplevnf
@@ -0,0 +1 @@
+samplevnf git /opt/rapid/samplevnf https://git.opnfv.org/samplevnf