Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 1a29751

Browse files
committed
test: Modify common to support Firecracker
We need to modify the common.bash in order to check for the Firecracker path as well to check the processes that run with Firecracker and Kata. Fixes #1070 Signed-off-by: Gabriela Cervantes <[email protected]>
1 parent 7467874 commit 1a29751

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/common.bash

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
# Place where virtcontainers keeps its active pod info
1111
VC_POD_DIR="${VC_POD_DIR:-/var/lib/vc/sbs}"
1212

13+
KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"
14+
1315
die(){
1416
msg="$*"
1517
echo "ERROR: $msg" >&2
@@ -42,7 +44,11 @@ extract_kata_env(){
4244
SHIM_VERSION="0.0.0"
4345
PROXY_PATH="/usr/libexec/kata-containers/kata-proxy"
4446
PROXY_VERSION="0.0.0"
45-
HYPERVISOR_PATH="/usr/bin/qemu-system-x86_64"
47+
if [ "$KATA_HYPERVISOR" == firecracker ]; then
48+
HYPERVISOR_PATH="/usr/bin/firecracker"
49+
else
50+
HYPERVISOR_PATH="/usr/bin/qemu-system-x86_64"
51+
fi
4652
HYPERVISOR_VERSION="0.0.0"
4753
INITRD_PATH=""
4854
NETMON_PATH="/usr/libexec/kata-containers/kata-netmon"
@@ -73,7 +79,13 @@ extract_kata_env(){
7379
# Checks that processes are not running
7480
check_processes() {
7581
extract_kata_env
76-
general_processes=( ${PROXY_PATH} ${HYPERVISOR_PATH} ${SHIM_PATH} )
82+
vsock_configured=$($RUNTIME_PATH kata-env | awk '/UseVSock/ {print $3}')
83+
vsock_supported=$($RUNTIME_PATH kata-env | awk '/SupportVSock/ {print $3}')
84+
if [ "$vsock_configured" == true ] && [ "$vsock_supported" == true ]; then
85+
general_processes=( ${HYPERVISOR_PATH} ${SHIM_PATH} )
86+
else
87+
general_processes=( ${PROXY_PATH} ${HYPERVISOR_PATH} ${SHIM_PATH} )
88+
fi
7789
for i in "${general_processes[@]}"; do
7890
if pgrep -f "$i"; then
7991
die "Found unexpected ${i} present"

0 commit comments

Comments
 (0)