CSIT-1416 Remove installation of vpp from containers
[csit.git] / resources / libraries / bash / function / device.sh
index 7363dc0..7d175a9 100644 (file)
@@ -108,8 +108,8 @@ function bind_interfaces_to_driver () {
 
 
 function clean_environment () {
-    # Cleanup environment by removing topology containers and binding
-    # interfaces back to original driver.
+    # Cleanup environment by removing topology containers and shared volumes
+    # and binding interfaces back to original driver.
     #
     # Variables read:
     # - DCR_UUIDS - Docker Container UUIDs.
@@ -124,6 +124,12 @@ function clean_environment () {
     # Kill docker containers.
     docker rm --force "${DCR_UUIDS[@]}" || die "Cleanup containers failed!"
 
+    # 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!"
+    }
+
     # Rebind interfaces back to kernel drivers.
     for ADDR in ${TG_PCIDEVS[@]}; do
         DRIVER="${TG_DRIVERS[0]}"
@@ -519,6 +525,8 @@ function start_topology_containers () {
     dcr_stc_params+="--volume /dev/vfio:/dev/vfio "
     # Mount nested_vm image to be able to run VM tests.
     dcr_stc_params+="--volume /var/lib/vm/vhost-nested.img:/var/lib/vm/vhost-nested.img "
+    # Mount docker.sock to be able to use docker deamon of the host.
+    dcr_stc_params+="--volume /var/run/docker.sock:/var/run/docker.sock "
 
     # Docker Container UUIDs.
     declare -gA DCR_UUIDS