aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2019-01-28 20:57:00 +0000
committerPeter Mikus <pmikus@cisco.com>2019-01-30 11:08:45 +0000
commit956989a5ad8966c06cf3300c2e5edf3f46466edb (patch)
treee309aba879451566ed03f1530e6b0bd01f95ff4e /resources/libraries
parentec88d060eee63d263e706fde464bc2c1a23f196a (diff)
FIX: Cleanup mechanics for vpp_device
Change-Id: Ice975127f8ecdd4cead418151cf37d61dfb218a0 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/bash/function/device.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh
index 7a61bf7f71..8aeb221fd9 100644
--- a/resources/libraries/bash/function/device.sh
+++ b/resources/libraries/bash/function/device.sh
@@ -124,9 +124,16 @@ function clean_environment () {
# Kill docker containers.
docker rm --force "${DCR_UUIDS[@]}" || die "Cleanup containers failed!"
- # Remove DUT1 /tmp volume
- docker volume rm "${DCR_VOLUMES[dut1]}" || {
- die "Failed to remove DUT1 /tmp volume!"
+ # 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]}) || {
+ 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.