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

Commit

Permalink
Merge pull request #1071 from GabyCT/topic/modifycommon
Browse files Browse the repository at this point in the history
test: Modify common to support Firecracker
  • Loading branch information
chavafg authored Jan 22, 2019
2 parents 59d2e7e + 1a29751 commit a56723e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# Place where virtcontainers keeps its active pod info
VC_POD_DIR="${VC_POD_DIR:-/var/lib/vc/sbs}"

KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"

die(){
msg="$*"
echo "ERROR: $msg" >&2
Expand Down Expand Up @@ -42,7 +44,11 @@ extract_kata_env(){
SHIM_VERSION="0.0.0"
PROXY_PATH="/usr/libexec/kata-containers/kata-proxy"
PROXY_VERSION="0.0.0"
HYPERVISOR_PATH="/usr/bin/qemu-system-x86_64"
if [ "$KATA_HYPERVISOR" == firecracker ]; then
HYPERVISOR_PATH="/usr/bin/firecracker"
else
HYPERVISOR_PATH="/usr/bin/qemu-system-x86_64"
fi
HYPERVISOR_VERSION="0.0.0"
INITRD_PATH=""
NETMON_PATH="/usr/libexec/kata-containers/kata-netmon"
Expand Down Expand Up @@ -73,7 +79,13 @@ extract_kata_env(){
# Checks that processes are not running
check_processes() {
extract_kata_env
general_processes=( ${PROXY_PATH} ${HYPERVISOR_PATH} ${SHIM_PATH} )
vsock_configured=$($RUNTIME_PATH kata-env | awk '/UseVSock/ {print $3}')
vsock_supported=$($RUNTIME_PATH kata-env | awk '/SupportVSock/ {print $3}')
if [ "$vsock_configured" == true ] && [ "$vsock_supported" == true ]; then
general_processes=( ${HYPERVISOR_PATH} ${SHIM_PATH} )
else
general_processes=( ${PROXY_PATH} ${HYPERVISOR_PATH} ${SHIM_PATH} )
fi
for i in "${general_processes[@]}"; do
if pgrep -f "$i"; then
die "Found unexpected ${i} present"
Expand Down

0 comments on commit a56723e

Please sign in to comment.