1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-10 01:16:42 +00:00

metrics: improving stop and remove running containers

This PR makes the change to using the SIGKILL signal instead
of SIGTERM to force stop each kata component before start
running any metric test.

Fixes: 

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
David Esparza 2023-10-27 15:40:55 -06:00
parent 3b2fb6a604
commit 28e7b3467b
No known key found for this signature in database
GPG Key ID: EABE0B1A98CC3B7A
2 changed files with 8 additions and 6 deletions
tests

View File

@ -158,7 +158,7 @@ function clean_env_ctr()
info "Wait until the containers gets removed"
for task_id in "${running_tasks[@]}"; do
sudo timeout -s SIGKILL 30s ctr t kill -a -s SIGTERM ${task_id} >/dev/null 2>&1 || true
sudo timeout -s SIGKILL 30s ctr t kill -a -s SIGKILL ${task_id} >/dev/null 2>&1 || true
sleep 0.5
done
@ -179,6 +179,7 @@ function clean_env_ctr()
[ "$count_running" -eq 0 ] && break
remaining_attempts=$((remaining_attempts-1))
sleep 0.5
done
count_tasks="$(sudo ctr t list -q | wc -l)"

View File

@ -176,13 +176,12 @@ function init_env()
# restart docker only if it is not masked by systemd
docker_masked="$(systemctl list-unit-files --state=masked | grep -c docker)" || true
if [ "${docker_masked}" -eq 0 ]; then
sudo systemctl restart docker
fi
[ "${docker_masked}" -eq 0 ] && sudo systemctl restart docker
# This clean up is more aggressive, this is in order to
# decrease the factors that could affect the metrics results.
kill_processes_before_start
check_processes
info "init environment complete"
}
@ -201,9 +200,11 @@ function kill_processes_before_start()
CTR_PROCS=$(sudo "${CTR_EXE}" t list -q)
[[ -n "${CTR_PROCS}" ]] && clean_env_ctr
kill_kata_components && sleep 1
restart_containerd_service
# Remove all running containers
# and kills all the kata components
kill_kata_components
check_processes
}
# Generate a random name - generally used when creating containers, but can