mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 23:38:31 +00:00
metrics: stop hypervirsor and shim at init_env stage
This PR kills the hypervisor and the kata shim in the init_env stage prior to launch any metric test. Additionally this PR adds info messages in the main blocks of the blogbench test to help in debugging. Fixes: #7366 Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
parent
7729d82e6e
commit
55e2f0955b
@ -181,7 +181,32 @@ function clean_env_ctr()
|
||||
count_tasks="$(sudo ctr t list -q | wc -l)"
|
||||
|
||||
if (( count_tasks > 0 )); then
|
||||
die "Can't remove running contaienrs."
|
||||
die "Can't remove running containers."
|
||||
fi
|
||||
|
||||
kill_kata_components
|
||||
}
|
||||
|
||||
# Kills running shim and hypervisor components
|
||||
function kill_kata_components() {
|
||||
local kata_bin_dir="/opt/kata/bin"
|
||||
local shim_path="${kata_bin_dir}/containerd-shim-kata-v2"
|
||||
local hypervisor_path="${kata_bin_dir}/qemu-system-x86_64"
|
||||
local pid_shim_count="$(pgrep -fc ${shim_path} || exit 0)"
|
||||
|
||||
[ ${pid_shim_count} -gt "0" ] && sudo kill -SIGKILL "$(pgrep -f ${shim_path})" > /dev/null 2>&1
|
||||
|
||||
if [ "${KATA_HYPERVISOR}" = 'clh' ]; then
|
||||
hypervisor_path="${kata_bin_dir}/cloud-hypervisor"
|
||||
elif [ "${KATA_HYPERVISOR}" != 'qemu' ]; then
|
||||
echo "Failed to stop the hypervisor: '${KATA_HYPERVISOR}' as it is not recognized"
|
||||
return
|
||||
fi
|
||||
|
||||
local pid_hypervisor_count="$(pgrep -fc ${hypervisor_path} || exit 0)"
|
||||
|
||||
if [ ${pid_hypervisor_count} -gt "0" ]; then
|
||||
sudo kill -SIGKILL "$(pgrep -f ${hypervisor_path})" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -178,6 +178,7 @@ function init_env()
|
||||
# This clean up is more aggressive, this is in order to
|
||||
# decrease the factors that could affect the metrics results.
|
||||
kill_processes_before_start
|
||||
info "init environment complete"
|
||||
}
|
||||
|
||||
# This function checks if there are containers or
|
||||
|
@ -39,6 +39,7 @@ function main() {
|
||||
sudo systemctl restart containerd
|
||||
metrics_json_init
|
||||
|
||||
info "Running Blogbench test"
|
||||
local output=$(sudo -E ${CTR_EXE} run --rm --runtime=${CTR_RUNTIME} ${IMAGE} test ${CMD})
|
||||
|
||||
# Save configuration
|
||||
@ -66,6 +67,7 @@ EOF
|
||||
metrics_json_end_array "Config"
|
||||
|
||||
# Save results
|
||||
info "Saving Blogbench results"
|
||||
metrics_json_start_array
|
||||
|
||||
local writes=$(tail -2 <<< "${output}" | head -1 | awk '{print $5}')
|
||||
|
Loading…
Reference in New Issue
Block a user