metrics: fix pargins json results file.

This PR encloses the search string for 'default_vcpus ='
and 'default_memory =' with double quotes in order to
parse the precise values, which are included in the kata
configuration file.

Fixes: #10118

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
David Esparza 2024-08-01 17:05:03 -06:00
parent 66b0305eed
commit 1e640ec3a6
No known key found for this signature in database
GPG Key ID: EABE0B1A98CC3B7A

View File

@ -179,8 +179,8 @@ function extract_kata_env() {
# get the requested memory and num of vcpus from the kata config file.
config_content="$(cat ${RUNTIME_CONFIG_PATH} | grep -vE "^#")"
REQ_MEMORY="$(echo "${config_content}" | grep -i default_memory | cut -d "=" -f2 | awk '{print $1}')"
REQ_NUM_VCPUS="$(echo "${config_content}" | grep -i default_vcpus | cut -d "=" -f2 | awk '{print $1}')"
REQ_MEMORY="$(echo "${config_content}" | grep -i 'default_memory =' | cut -d "=" -f2 | awk '{print $1}')"
REQ_NUM_VCPUS="$(echo "${config_content}" | grep -i 'default_vcpus =' | cut -d "=" -f2 | awk '{print $1}')"
# Shimv2 path is being affected by https://github.com/kata-containers/kata-containers/issues/1151
SHIM_PATH=$(command -v containerd-shim-kata-v2)
@ -188,7 +188,10 @@ function extract_kata_env() {
SHIM_VERSION=${RUNTIME_VERSION}
HYPERVISOR_PATH=$(sudo ${cmd} env --json | jq -r ${hypervisor_path})
HYPERVISOR_PATH=$(echo "${kata_env}" | jq -r ${hypervisor_path})
VIRTIOFSD_PATH=$(echo "${kata_env}" | jq -r ${virtio_fs_daemon_path})
INITRD_PATH=$(echo "${kata_env}" | jq -r ${initrd_path})
# TODO: there is no ${cmd} of rust version currently
if [ "${KATA_HYPERVISOR}" != "dragonball" ]; then
if [ "${KATA_HYPERVISOR}" = "stratovirt" ]; then
@ -197,9 +200,6 @@ function extract_kata_env() {
HYPERVISOR_VERSION=$(sudo -E ${HYPERVISOR_PATH} --version | head -n1)
fi
fi
VIRTIOFSD_PATH=$(sudo ${cmd} env --json | jq -r ${virtio_fs_daemon_path})
INITRD_PATH=$(sudo ${cmd} env --json | jq -r ${initrd_path})
}
# Checks that processes are not running