From 4691f0df2588e6f9f2080f5f0c005b5510b97ba6 Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Fri, 20 Oct 2023 10:27:37 -0400 Subject: [PATCH] Add KVM tests to healthcheck Signed-off-by: Kyle Harding --- Dockerfile | 6 +++--- overlay/usr/local/bin/healthcheck.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b65cda..c4e96dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -116,7 +116,7 @@ CMD [ "/usr/local/bin/usage.sh" ] FROM alpine:3.18 AS alpine-rootfs # hadolint ignore=DL3018 -RUN apk add --no-cache bash ca-certificates ca-certificates curl iproute2 iputils-ping lsblk +RUN apk add --no-cache bash ca-certificates ca-certificates curl iproute2 iputils-ping kmod lsblk FROM jailer AS alpine-test @@ -133,7 +133,7 @@ FROM debian:bookworm AS debian-rootfs # hadolint ignore=DL3008 RUN apt-get update \ - && apt-get install -y --no-install-recommends curl iproute2 iputils-ping ca-certificates util-linux \ + && apt-get install -y --no-install-recommends ca-certificates cpu-checker curl iproute2 iputils-ping util-linux \ && rm -rf /var/lib/apt/lists/* FROM jailer AS debian-test @@ -147,7 +147,7 @@ FROM ubuntu:jammy AS ubuntu-rootfs # hadolint ignore=DL3008 RUN apt-get update \ - && apt-get install -y --no-install-recommends ca-certificates curl iproute2 iputils-ping util-linux \ + && apt-get install -y --no-install-recommends ca-certificates cpu-checker curl iproute2 iputils-ping util-linux \ && rm -rf /var/lib/apt/lists/* FROM jailer AS ubuntu-test diff --git a/overlay/usr/local/bin/healthcheck.sh b/overlay/usr/local/bin/healthcheck.sh index fd4bc1b..0b76c56 100644 --- a/overlay/usr/local/bin/healthcheck.sh +++ b/overlay/usr/local/bin/healthcheck.sh @@ -24,6 +24,13 @@ ping -c 4 -M "do" -s 1472 "$(head -1 /etc/resolv.conf | awk '{print $2}')" curl -fsSL https://raw.githubusercontent.com/dylanaraps/neofetch/7.1.0/neofetch | bash +test -r /dev/kvm +test -w /dev/kvm + +if which kvm-ok > /dev/null; then + kvm-ok +fi + mkdir -p /mnt/data mount -v /dev/vdb /mnt/data touch /mnt/data/healthy