metrics: Stop running kata-env before kata is properly installed.

This PR makes kata-env is called only after some metrics have
completed his workload. This fixes a bug that occurs when
kata-env was being called before kata is already installed on the
testing platform.

Fixes: #7348

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
David Esparza 2023-07-14 13:28:52 -06:00
parent b9535fb187
commit 59f4731bb2
No known key found for this signature in database
GPG Key ID: EABE0B1A98CC3B7A
3 changed files with 9 additions and 6 deletions

View File

@ -342,6 +342,9 @@ EOF
} }
function main(){ function main(){
# Collect kata-env data
common_init
# Verify enough arguments # Verify enough arguments
if [ $# != 2 ] && [ $# != 3 ];then if [ $# != 2 ] && [ $# != 3 ];then
echo >&2 "error: Not enough arguments [$@]" echo >&2 "error: Not enough arguments [$@]"

View File

@ -18,7 +18,6 @@ DOCKER_EXE="${DOCKER_EXE:-docker}"
CTR_RUNTIME="${CTR_RUNTIME:-io.containerd.kata.v2}" CTR_RUNTIME="${CTR_RUNTIME:-io.containerd.kata.v2}"
RUNTIME="${RUNTIME:-containerd-shim-kata-v2}" RUNTIME="${RUNTIME:-containerd-shim-kata-v2}"
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}" KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"
TEST_REPO="${TEST_REPO:-github.com/kata-containers/tests}"
JSON_HOST="${JSON_HOST:-}" JSON_HOST="${JSON_HOST:-}"
KSM_BASE="/sys/kernel/mm/ksm" KSM_BASE="/sys/kernel/mm/ksm"
@ -220,11 +219,11 @@ function show_system_ctr_state()
function common_init() function common_init()
{ {
if [ "$CTR_RUNTIME" == "io.containerd.kata.v2" ] || [ "$RUNTIME" == "containerd-shim-kata-v2" ]; then if [ "${CTR_RUNTIME}" = "io.containerd.kata.v2" ] || [ "${RUNTIME}" = "containerd-shim-kata-v2" ]; then
extract_kata_env extract_kata_env
else else
# We know we have nothing to do for runc or shimv2 # We know we have nothing to do for runc or shimv2
if [ "$CTR_RUNTIME" != "io.containerd.runc.v2" ] || [ "$RUNTIME" != "runc" ]; then if [ "${CTR_RUNTIME}" != "io.containerd.runc.v2" ] && [ "${RUNTIME}" != "runc" ]; then
warn "Unrecognised runtime" warn "Unrecognised runtime"
fi fi
fi fi
@ -359,5 +358,3 @@ function wait_ksm_settle()
done done
info "Timed out after ${1}s waiting for KSM to settle" info "Timed out after ${1}s waiting for KSM to settle"
} }
common_init

View File

@ -32,8 +32,11 @@ timestamp_ms() {
echo $(($(date +%s%N)/1000000)) echo $(($(date +%s%N)/1000000))
} }
# Intialise the json subsystem # Initialise the json subsystem
metrics_json_init() { metrics_json_init() {
# collect kata-env data
common_init
# Clear out any previous results # Clear out any previous results
json_result_array=() json_result_array=()