metrics: increase the number of attempts to stop kata

This PR increases the number of attempts to stop kata components
when it is required usually before starting a metrics test.

Fixes: #8307

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
David Esparza 2023-10-24 09:27:32 -06:00
parent 1626253d9e
commit c42a2f2eda
No known key found for this signature in database
GPG Key ID: EABE0B1A98CC3B7A
2 changed files with 7 additions and 3 deletions

View File

@ -190,13 +190,17 @@ function clean_env_ctr()
# Kills running shim and hypervisor components
function kill_kata_components() {
local ATTEMPTS=2
local TIMEOUT="30s"
local PID_NAMES=( "containerd-shim-kata-v2" "qemu-system-x86_64" "cloud-hypervisor" )
sudo systemctl stop containerd
# iterate over the list of kata components and stop them
for PID_NAME in "${PID_NAMES[@]}"; do
[[ ! -z "$(pidof ${PID_NAME})" ]] && sudo killall "${PID_NAME}" > /dev/null 2>&1 || true
for (( i=1; i<=ATTEMPTS; i++ )); do
for PID_NAME in "${PID_NAMES[@]}"; do
[[ ! -z "$(pidof ${PID_NAME})" ]] && sudo killall "${PID_NAME}" >/dev/null 2>&1 || true
done
sleep 1
done
sudo timeout -s SIGKILL "${TIMEOUT}" systemctl start containerd
}

View File

@ -201,8 +201,8 @@ function kill_processes_before_start()
CTR_PROCS=$(sudo "${CTR_EXE}" t list -q)
[[ -n "${CTR_PROCS}" ]] && clean_env_ctr
kill_kata_components && sleep 1
kill_kata_components
check_processes
}