metrics: Improvement to the description of certain functions.

This PR rephrased the description and usage of certain functions
as such as:
- set_kata_configuration_performance
- set_kata_config_file
- get_current_kata_config_file
- check_if_root
- check_ctr_images

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
David Esparza 2024-07-04 13:39:00 -06:00
parent 37b907dfbc
commit a554541495
No known key found for this signature in database
GPG Key ID: EABE0B1A98CC3B7A

View File

@ -128,8 +128,9 @@ function build_dockerfile_image()
|| die "Failed to docker build image $image"
}
# This function removes the ctr image, builds a new one using a dockerfile
# and imports the image from docker to ctr
# This function deletes any existing ctr image passed as a parameter,
# then creates a new image using a dockerfile, and finally exports
# a new version of the docker image to ctr.
function check_ctr_images()
{
local ctr_image="$1"
@ -437,11 +438,11 @@ function check_containers_are_running() {
fi
}
# This function receives an identifier used to name a performance Kata configuration file.
# The current kata configuration is copied to a new kata config file with the difference
# that the parameters 'default_vcpus' and 'default_memory' will be updated with the values
# of the max vcpus and the available memory in the system.
# Finally it makes Kata point to the new configuration file.
# This function generates a new kata configuration file based on the current configuration file,
# with the update of two parameters: 'default_vcpus' and 'default_memory'.
# These parameters are updated so that they point to the maximum number of vcpus available
# on the system and to use all the available memory on the system.
# Finally, a link to the new configuration file is created for kata to use in creating containers.
set_kata_configuration_performance() {
WORKLOAD_CONFIG_FILE="${1}"
@ -476,8 +477,8 @@ function clean_cache() {
sudo sync; echo 1 > /proc/sys/vm/drop_caches
}
# This function receives as single parameter, the name of a valid Kata configuration file
# which will be established as the default Kata configuration to start new Kata containers.
# This function receives as a single parameter the path to a valid kata configuration file
# that will be set as the configuration used to start new Kata containers.
function set_kata_config_file() {
NEW_KATA_CONFIG=${1}
@ -495,6 +496,8 @@ function set_kata_config_file() {
popd > /dev/null
}
# This function returns the path to the symbolic link pointed to by the kata
# configuration file: configuration.toml.
function get_current_kata_config_file() {
declare -n current_config_file=$1
@ -505,6 +508,8 @@ function get_current_kata_config_file() {
current_config_file="${KATA_CONFIG_FNAME}"
}
# This function checks if the current session is runnin as root,
# if that is not the case, the function exits with an error message.
function check_if_root() {
[ "$EUID" -ne 0 ] && die "Please run as root or use sudo."
}