diff options
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/bash/config/config | 8 | ||||
-rw-r--r-- | resources/libraries/bash/config/defaults | 7 | ||||
-rwxr-xr-x | resources/libraries/bash/k8s_setup.sh | 15 | ||||
-rwxr-xr-x | resources/libraries/bash/qemu_build.sh | 58 | ||||
-rw-r--r-- | resources/libraries/bash/shell/dpdk_utils.sh | 92 | ||||
-rw-r--r-- | resources/libraries/bash/shell/qemu_utils.sh | 81 |
6 files changed, 3 insertions, 258 deletions
diff --git a/resources/libraries/bash/config/config b/resources/libraries/bash/config/config deleted file mode 100644 index 8cd1fe4793..0000000000 --- a/resources/libraries/bash/config/config +++ /dev/null @@ -1,8 +0,0 @@ -QEMU_INSTALL_DIR=/opt/qemu-2.11.2 -QEMU_INSTALL_VERSION=qemu-2.11.2 -QEMU_PATCH=false -QEMU_FORCE_INSTALL=false -QEMU_TARGET_LIST=x86_64-softmmu - -DPDK_INSTALL_DIR=/opt -DPDK_INSTALL_VERSION=dpdk-17.11 diff --git a/resources/libraries/bash/config/defaults b/resources/libraries/bash/config/defaults index 547fece17d..6a25a5f04d 100644 --- a/resources/libraries/bash/config/defaults +++ b/resources/libraries/bash/config/defaults @@ -2,13 +2,6 @@ typeset -A cfg cfg=( # set default values in config array - [QEMU_INSTALL_DIR]="/opt/qemu-2.11.2" - [QEMU_INSTALL_VERSION]="qemu-2.11.2" - [QEMU_PATCH]=false - [QEMU_FORCE_INSTALL]=false - [QEMU_TARGET_LIST]=x86_64-softmmu - [DPDK_INSTALL_DIR]=/opt - [DPDK_INSTALL_VERSION]=dpdk-17.11 [K8S_CALICO]="${SCRIPT_DIR}/../../templates/kubernetes/calico_v2.6.3.yaml" [K8S_CONTIV_VPP]="https://raw.githubusercontent.com/contiv/vpp/master/k8s/contiv-vpp.yaml" [K8S_CSIT]="${SCRIPT_DIR}/../../templates/kubernetes/csit.yaml" diff --git a/resources/libraries/bash/k8s_setup.sh b/resources/libraries/bash/k8s_setup.sh index 4128512f21..6ebfeecadd 100755 --- a/resources/libraries/bash/k8s_setup.sh +++ b/resources/libraries/bash/k8s_setup.sh @@ -18,19 +18,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Include source ${SCRIPT_DIR}/config/defaults -source ${SCRIPT_DIR}/shell/dpdk_utils.sh source ${SCRIPT_DIR}/shell/k8s_utils.sh -# Read configuration -while read line -do - if echo $line | grep -F = &>/dev/null - then - varname=$(echo "$line" | cut -d '=' -f 1) - cfg[$varname]=$(echo "$line" | cut -d '=' -f 2-) - fi -done < ${SCRIPT_DIR}/config/config - trap "k8s_utils.destroy" ERR case "$1" in @@ -44,7 +33,9 @@ case "$1" in # Revert any changes made to this host by 'kubeadm init' k8s_utils.destroy # Load kernel modules uio/uio_pci_generic - dpdk_utils.load_modules + sudo modprobe uio + sudo modprobe uio_pci_generic + sudo modprobe vfio_pci # Sets up the Kubernetes master k8s_utils.prepare "--pod-network-cidr=192.168.0.0/16" # Apply resources diff --git a/resources/libraries/bash/qemu_build.sh b/resources/libraries/bash/qemu_build.sh deleted file mode 100755 index 4638ec1bcb..0000000000 --- a/resources/libraries/bash/qemu_build.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# Copyright (c) 2018 Cisco and/or its affiliates. -# 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. - -set -x - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Include -source ${SCRIPT_DIR}/config/defaults -source ${SCRIPT_DIR}/shell/qemu_utils.sh - -# Read configuration -while read line -do - if echo $line | grep -F = &>/dev/null - then - varname=$(echo "$line" | cut -d '=' -f 1) - cfg[$varname]=$(echo "$line" | cut -d '=' -f 2-) - fi -done < ${SCRIPT_DIR}/config/config - -# Read parameters -for i in "$@"; do - case $i in - --version=*) - cfg['QEMU_INSTALL_VERSION']="${i#*=}" - shift ;; - --directory=*) - cfg['QEMU_INSTALL_DIR']="${i#*=}" - shift ;; - --patch) - cfg['QEMU_PATCH']=true - shift ;; - --force) - cfg['QEMU_FORCE_INSTALL']=true - shift ;; - --target-list) - cfg['QEMU_TARGET_LIST']="${i#*=}" - shift ;; - *) - ;; - esac -done - -# Install qemu -qemu_utils.qemu_install ${cfg[QEMU_INSTALL_DIR]} ${cfg[QEMU_INSTALL_VERSION]} \ - ${cfg[QEMU_PATCH]} ${cfg[QEMU_FORCE_INSTALL]} ${cfg[QEMU_TARGET_LIST]} diff --git a/resources/libraries/bash/shell/dpdk_utils.sh b/resources/libraries/bash/shell/dpdk_utils.sh deleted file mode 100644 index 9f81aaabce..0000000000 --- a/resources/libraries/bash/shell/dpdk_utils.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# Copyright (c) 2018 Cisco and/or its affiliates. -# 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. - -function dpdk_utils.dpdk_delete { - # Deletes the DPDK directory - # DPDK install directory - dpdk_install_dir=$1 - # DPDK install version - dpdk_install_ver=$2 - - [ -d ${dpdk_install_dir}/${dpdk_install_ver} ] && \ - sudo rm -r ${dpdk_install_dir}/${dpdk_install_ver} && \ - echo "${dpdk_install_dir}/${dpdk_install_ver} removed" -} - -function dpdk_utils.dpdk_install { - # Downloads and installs DPDK - # DPDK install directory - dpdk_install_dir=$1 - # DPDK install version - dpdk_install_ver=$2 - # DPDK compile target - dpdk_target=x86_64-native-linuxapp-gcc - # Force install (if true then remove previous installation; default false) - force_install=${3:-false} - - if [ "$force_install" = true ]; then - # Cleanup DPDK DIR - dpdk_utils.dpdk_delete ${dpdk_install_dir} ${dpdk_install_ver} - else - # Test if DPDK was installed previously - test -d ${dpdk_install_dir}/${dpdk_install_ver} && \ - { echo "DPDK ${dpdk_install_ver} ready"; exit 0; } - fi - - # Download the DPDK package if no local copy exists - if [ ! -f ${dpdk_install_dir}/${dpdk_install_ver}.tar.xz ]; then - sudo wget -e use_proxy=yes -P ${dpdk_install_dir} -q \ - fast.dpdk.org/rel/${dpdk_install_ver}.tar.xz || \ - { echo "Failed to download ${dpdk_install_ver}"; exit 1; } - fi - - # Create DPDK install dir if not exists and extract - sudo mkdir -p ${dpdk_install_dir} || \ - { echo "Failed to create ${dpdk_install_dir}"; exit 1; } - sudo tar -xJf ${dpdk_install_dir}/${dpdk_install_ver}.tar.xz \ - -C ${dpdk_install_dir} || \ - { echo "Failed to extract ${dpdk_install_ver}.tar.xz"; exit 1; } - - cd ${dpdk_install_dir}/${dpdk_install_ver} - - # Compile and install the DPDK - sudo make install T=${dpdk_target} -j DESTDIR=install || \ - { echo "Installation of ${dpdk_install_ver} failed"; exit 1; } - - echo "DPDK ${dpdk_install_ver} ready" -} - -function dpdk_utils.load_modules { - # Loads kernel modules and bind interfaces to drivers - # Use igb_uio [true|false] - use_igb_uio=${1:-false} - # DPDK install directory - dpdk_install_dir=$2 - # DPDK install version - dpdk_install_ver=$3 - - sudo modprobe uio - sudo modprobe uio_pci_generic - - if [ "${use_igb_uio}" = true ]; then - sudo rmmod igb_uio - # Try to insert IGB_UIO module - sudo insmod ${dpdk_install_dir}/${dpdk_install_ver}/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko - # If failed then download/compile DPDK - if [ $? -ne 0 ]; then - dpdk_utils.dpdk_install ${dpdk_install_dir} ${dpdk_install_ver} true - sudo insmod ${dpdk_install_dir}/${dpdk_install_ver}/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko - fi - fi -} diff --git a/resources/libraries/bash/shell/qemu_utils.sh b/resources/libraries/bash/shell/qemu_utils.sh deleted file mode 100644 index cabf93d978..0000000000 --- a/resources/libraries/bash/shell/qemu_utils.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# Copyright (c) 2018 Cisco and/or its affiliates. -# 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. - -function qemu_utils.qemu_delete { - # Deletes the QEMU directory - # QEMU install directory - local qemu_install_dir=$1 - - [ -d ${qemu_install_dir} ] && \ - sudo rm -r ${qemu_install_dir} && \ - echo "${qemu_install_dir} removed" -} - -function qemu_utils.qemu_install { - # Downloads and installs QEMU - # QEMU install directory - local qemu_install_dir=$1 - # QEMU install version - local qemu_install_ver=$2 - # QEMU patch - local qemu_patch=${3:-false} - # Force install (if true then remove previous installation; default false) - local force_install=${4:-false} - # QEMU repo URL - local qemu_package_url="http://download.qemu-project.org/${qemu_install_ver}.tar.xz" - # QEMU target arch - local qemu_target_list=${5:-x86_64-softmmu} - - if [ $force_install = true ]; then - # Cleanup QEMU dir - qemu_utils.qemu_delete $qemu_install_dir - else - # Test if QEMU was installed previously - test -d $qemu_install_dir && \ - { echo "Qemu already installed: $qemu_install_dir"; exit 0; } - fi - - local tmp_dir=$(mktemp -d) || \ - { echo "Failed to create temporary working dir"; exit 1; } - trap "sudo rm -r ${tmp_dir}" EXIT - - # Download QEMU source code if no local copy exists - if [ ! -f /opt/${qemu_install_ver}.tar.xz ]; then - sudo wget -e use_proxy=yes -P /opt -q ${qemu_package_url} || \ - { echo "Failed to download ${qemu_install_ver}"; exit 1; } - fi - tar --strip-components 1 -xf /opt/${qemu_install_ver}.tar.xz -C ${tmp_dir} || \ - { echo "Failed to exctract ${qemu_install_ver}.tar.xz"; exit 1; } - - cd ${tmp_dir} - sudo mkdir -p ${qemu_install_dir} || \ - { echo "Failed to create ${qemu_install_dir}"; exit 1; } - - # Apply additional patches - if [ $qemu_patch = true ] - then - chmod +x ${SCRIPT_DIR}/qemu_patches/${qemu_install_ver}/* - run-parts --verbose --report ${SCRIPT_DIR}/qemu_patches/${qemu_install_ver} - fi - - # Build - sudo ./configure --target-list=${qemu_target_list} --prefix=${qemu_install_dir} || \ - { echo "Failed to configure ${qemu_install_ver}"; exit 1; } - sudo make -j`nproc` || \ - { echo "Failed to compile ${qemu_install_ver}"; exit 1; } - sudo make install || \ - { echo "Failed to install ${qemu_install_ver}"; exit 1; } - - echo "QEMU ${qemu_install_ver} ready" -} |