Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ DOCKER_PREFIX := ${LIB_NAME}
DOCKER_TAG := ${DOCKER_PREFIX}-yocto-builder
DOCKER_SUSE_TAG := ${DOCKER_PREFIX}-open-suse-env
DOCKER_PYTHON_TAG := ${DOCKER_PREFIX}-analyzer
DOCKER_SUSE_VM_TAG := ${DOCKER_PREFIX}-suse-vm
DOCKER_BUILD_VOLUME := ${DOCKER_PREFIX}-yocto-build
DOCKER_DOWNLOADS_VOLUME := ${DOCKER_PREFIX}-yocto-downloads
DOCKER_SSTATE_VOLUME := ${DOCKER_PREFIX}-yocto-sstate
Expand Down
19 changes: 17 additions & 2 deletions docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,28 @@ services:
environment:
S_USER: ${S_USER}
PASSWORD: ${PASSWORD}
VM_RAM: ${QEMU_VM_RAM}
CPUS: ${CPUS}
networks:
- yocto-network

imgtests-suse-vm:
build:
dockerfile: docker/vm-suse.dockerfile
args:
USER: ${USER}
image: ${DOCKER_SUSE_VM_TAG}
privileged: true
devices:
- /dev/kvm
volumes:
- ${DOCKER_OPENSUSE_VOLUME}:${SUSE_DIR}
environment:
SSH_QEMU_PORT: ${SSH_TO_QEMU_PORT}
SSH_SUSE_PORT: ${SSH_SUSE_PORT_156}
SUSE_NE_PORT: ${SUSE_156_NE_PORT}
DEFAULT_NE_PORT: ${DEFAULT_NE_PORT}
IPERF3_PORT: ${IPERF3_PORT}
VM_RAM: ${QEMU_VM_RAM}
CPUS: ${CPUS}
ports:
- ${SSH_SUSE_PORT_156}:${SSH_SUSE_PORT_156}
networks:
Expand Down
3 changes: 0 additions & 3 deletions docker/open-suse.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ ENV DEBIAN_FRONTEND=noninteractive \

RUN apt-get update && \
apt-get install -y --no-install-recommends \
qemu-system \
qemu-utils \
qemu-user-static \
cloud-init \
cloud-image-utils \
wget \
Expand Down
19 changes: 19 additions & 0 deletions docker/vm-suse.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:24.04

ARG USER

ENV DEBIAN_FRONTEND=noninteractive \
SUSE_DIR=/home/${USER}/suse

RUN apt-get update && \
apt-get install -y --no-install-recommends \
qemu-system \
qemu-utils \
qemu-user-static

WORKDIR ${SUSE_DIR}

COPY scripts/opensuse/start-vm.sh /start-vm.sh
RUN chmod +x /start-vm.sh

ENTRYPOINT ["/start-vm.sh"]
20 changes: 20 additions & 0 deletions scripts/opensuse/start-vm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

cd "${SUSE_DIR}"

echo "Waiting for OpenSUSE image to be ready..."
while true; do
for img in open-suse-*.ready.qcow2; do
[ -f "$img" ] && IMAGE="$img" && break 2
done
sleep 10
done

exec qemu-system-x86_64 -enable-kvm -m "${VM_RAM}" -smp "${CPUS}" -nographic \
-monitor tcp:0.0.0.0:4444,server,nowait \
-drive file="$IMAGE",index=0,media=disk \
-cdrom cloud-init.iso \
-net user,hostfwd=tcp::"${SSH_SUSE_PORT}"-:"${SSH_QEMU_PORT}",hostfwd=tcp::"${SUSE_NE_PORT}"-:"${DEFAULT_NE_PORT}",hostfwd=tcp:0.0.0.0:"${IPERF3_PORT}"-:"${IPERF3_PORT}",hostfwd=udp:0.0.0.0:"${IPERF3_PORT}"-:"${IPERF3_PORT}" \
-net nic
4 changes: 1 addition & 3 deletions scripts/opensuse/suse-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ set -e

./scripts/download_images.py "$1"
./scripts/cloud-setup.sh "${S_USER}" "${PASSWORD}"
CPUS=4
qemu-system-x86_64 -m "${VM_RAM}" -smp "${CPUS}" -nographic -monitor tcp:0.0.0.0:4444,server,nowait -drive file=open-suse-"$1".ready.qcow2,index=0,media=disk \
-cdrom cloud-init.iso -net user,hostfwd=tcp::"${SSH_SUSE_PORT}"-:"${SSH_QEMU_PORT}",hostfwd=tcp::"${SUSE_NE_PORT}"-:"${DEFAULT_NE_PORT}",hostfwd=tcp:0.0.0.0:"${IPERF3_PORT}"-:"${IPERF3_PORT}",hostfwd=udp:0.0.0.0:"${IPERF3_PORT}"-:"${IPERF3_PORT}" -net nic
echo "Image is ready. VM will be started by imgtests-suse-vm container."
Loading