From 22ff475dae7f9f09e8b3b7c899731803752761c0 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Fri, 1 Feb 2019 14:51:06 +0000 Subject: CSIT-1416 Remove installation of vpp from containers Use parent system (Host, Container) installation of VPP. This will save the internet bandwith by skip installing of prerequisites packages. It will also skip dpkg install and simplify the process of initializing VPP inside container. Previosly initialization of VPP in container takes about 55s. With this patch it is reduced to 2-3s. This patch removes the bloated VOLUME creation between container sidecars (a.k.a nested container) and fixes the hugepage allocation. Change-Id: Ifa2be532edb77354657e1b84568bdc34993b00d0 Signed-off-by: Peter Mikus --- resources/libraries/bash/function/device.sh | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'resources/libraries/bash/function/device.sh') diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh index 8aeb221fd9..7d175a9ac3 100644 --- a/resources/libraries/bash/function/device.sh +++ b/resources/libraries/bash/function/device.sh @@ -124,18 +124,12 @@ function clean_environment () { # Kill docker containers. docker rm --force "${DCR_UUIDS[@]}" || die "Cleanup containers failed!" - # Check if some container is using volume and remove all the hanged - # containers before removing volume. Command will not fail in case there - # are no containers to remove. - docker rm --force $(docker ps -q --filter volume=${DCR_VOLUMES[dut1]}) || { + # Check if there are some leftover containers and remove all. Command will + # not fail in case there are no containers to remove. + docker rm --force $(docker ps -q --filter name=${DCR_UUIDS[dut1]}) || { warn "Failed to remove hanged containers or nothing to remove!" } - # Remove DUT1 volume. - docker volume rm --force "${DCR_VOLUMES[dut1]}" || { - die "Failed to remove DUT1 volume!" - } - # Rebind interfaces back to kernel drivers. for ADDR in ${TG_PCIDEVS[@]}; do DRIVER="${TG_DRIVERS[0]}" @@ -432,10 +426,8 @@ function read_env_variables () { export "${param}" done declare -gA DCR_UUIDS - declare -gA DCR_VOLUMES DCR_UUIDS+=([tg]="${CSIT_TG_UUID}") DCR_UUIDS+=([dut1]="${CSIT_DUT1_UUID}") - DCR_VOLUMES+=([dut1]="${CSIT_DUT1_VOL}") TG_PCIDEVS=("${CSIT_TG_INTERFACES_PORT1_PCI}") TG_DRIVERS=("${CSIT_TG_INTERFACES_PORT1_DRV}") TG_PCIDEVS+=("${CSIT_TG_INTERFACES_PORT2_PCI}") @@ -479,7 +471,6 @@ function set_env_variables () { CSIT_DUT1_ARCH="$(uname -i)" || { die "Reading machine architecture failed!" } - CSIT_DUT1_VOL="${DCR_VOLUMES[dut1]}" CSIT_TG_INTERFACES_PORT1_MAC="${TG_NETMACS[0]}" CSIT_TG_INTERFACES_PORT1_PCI="${TG_PCIDEVS[0]}" CSIT_TG_INTERFACES_PORT1_DRV="${TG_DRIVERS[0]}" @@ -543,25 +534,13 @@ function start_topology_containers () { declare -gA DCR_PORTS # Docker Container PIDs (namespaces). declare -gA DCR_CPIDS - # Docker Container volumes with no relationship to the host. - declare -gA DCR_VOLUMES - - # Create DUT1 /tmp volume to be able to install VPP in "nested" container. - params=(--name DUT1_VOL_$(uuidgen)) - DCR_VOLUMES+=([dut1]="$(docker volume create "${params[@]}")") || { - die "Failed to create DUT1 /tmp volume!" - } - - # Mount DUT1_VOL as /tmp directory on DUT1 container - dcr_stc_params_dut1="--volume ${DCR_VOLUMES[dut1]}:/tmp " # Run TG and DUT1. As initial version we do support only 2-node. params=(${dcr_stc_params} --name csit-tg-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([tg]="$(docker run "${params[@]}")") || { die "Failed to start TG docker container!" } - params=(${dcr_stc_params} ${dcr_stc_params_dut1} - --name csit-dut1-$(uuidgen) ${dcr_image}) + params=(${dcr_stc_params} --name csit-dut1-$(uuidgen) ${dcr_image}) DCR_UUIDS+=([dut1]="$(docker run "${params[@]}")") || { die "Failed to start DUT1 docker container!" } -- cgit 1.2.3-korg