manager: Add options to change self test behaviour

Added new `kata-manager` options to control the self-test behaviour. By
default, after installation the manager will run a test to ensure a Kata
Containers container can be created. New options allow:

- The self test to be disabled.
- Only the self test to be run (no installation).

These features allow changes to be made to the installed system before
the self test is run.

Fixes: #3851.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2022-03-08 16:41:54 +00:00
parent d4d65bed38
commit 9576a7da5d

View File

@ -214,6 +214,8 @@ Options:
-k <version> : Specify Kata Containers version.
-o : Only install Kata Containers.
-r : Don't cleanup on failure (retain files).
-t : Disable self test (don't try to create a container after install).
-T : Only run self test (do not install anything).
Notes:
@ -697,9 +699,17 @@ handle_installation()
local enable_debug="${4:-}"
[ -z "$enable_debug" ] && die "no enable debug value"
local disable_test="${5:-}"
[ -z "$disable_test" ] && die "no disable test value"
local only_run_test="${6:-}"
[ -z "$only_run_test" ] && die "no only run test value"
# These params can be blank
local kata_version="${5:-}"
local containerd_version="${6:-}"
local kata_version="${7:-}"
local containerd_version="${8:-}"
[ "$only_run_test" = "true" ] && test_installation && return 0
setup "$cleanup" "$force"
@ -711,6 +721,8 @@ handle_installation()
"$force" \
"$enable_debug"
[ "$disable_test" = "false" ] && test_installation
if [ "$only_kata" = "true" ]
then
info "$kata_project is now installed"
@ -726,6 +738,8 @@ handle_args()
local cleanup="true"
local force="false"
local only_kata="false"
local disable_test="false"
local only_run_test="false"
local enable_debug="false"
local opt
@ -733,7 +747,7 @@ handle_args()
local kata_version=""
local containerd_version=""
while getopts "c:dfhk:or" opt "$@"
while getopts "c:dfhk:ortT" opt "$@"
do
case "$opt" in
c) containerd_version="$OPTARG" ;;
@ -743,6 +757,8 @@ handle_args()
k) kata_version="$OPTARG" ;;
o) only_kata="true" ;;
r) cleanup="false" ;;
t) disable_test="true" ;;
T) only_run_test="true" ;;
esac
done
@ -756,6 +772,8 @@ handle_args()
"$force" \
"$only_kata" \
"$enable_debug" \
"$disable_test" \
"$only_run_test" \
"$kata_version" \
"$containerd_version"
}