Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gen-vm and run-vm cleanup #42

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 25 additions & 4 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: qemu-minimal-smoke-test
name: smoke-tests

on:
pull_request:
branches: [ main ]

jobs:
ubuntu-smoke-test:
name: ubuntu-smoke-test

ubuntu-latest-x86:
name: ubuntu-latest-x86
runs-on: ubuntu-latest
steps:
- name: Check out code using action/checkout
Expand All @@ -15,11 +16,31 @@ jobs:
run: sudo apt update && sudo apt install -y qemu-system-x86 cloud-image-utils
- name: Generate an ssh key-pair for this test
run: ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
- name: Run a qemu-based ./gen-vm smoke-test
- name: Generate a x86_64 qemu-based ./gen-vm smoke-test
run: ./gen-vm
working-directory: qemu
env:
VM_NAME: qemu-minimal-smoke-test
KVM: none
USERNAME: ubuntu
PASS: password

ubuntu-latest-arm64:
name: ubuntu-latest-arm64
runs-on: ubuntu-latest
steps:
- name: Check out code using action/checkout
uses: actions/[email protected]
- name: Install a couple of packages via the apt package manager
run: sudo apt update && sudo apt install -y qemu-system-arm cloud-image-utils
- name: Generate an ssh key-pair for this test
run: ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
- name: Run a aarch64 qemu-based ./gen-vm smoke-test
run: ./gen-vm
working-directory: qemu
env:
VM_NAME: qemu-minimal-smoke-test-arm64
KVM: none
USERNAME: ubuntu
PASS: password
ARCH: arm64
6 changes: 3 additions & 3 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: qemu-minimal-spell-check
name: spell-check

on:
pull_request:
Expand All @@ -9,8 +9,8 @@ on:
- '.spellcheck.yaml'

jobs:
ubuntu-spell-check:
name: ubuntu-spell-check
ubuntu-latest:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Check out code.
Expand Down
2 changes: 1 addition & 1 deletion qemu/gen-vm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ----------------
#
# Note that for Jammy you need the cloud-init as well as
# cloud-image-utils and for focal a good generic call would be:
# cloud-image-utils and for jammy a good generic call would be:
#
# RELEASE=jammy VM_NAME=stephen ./gen-vm
#
Expand Down
20 changes: 9 additions & 11 deletions qemu/run-vm
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ IMAGES=${IMAGES:-../images}
SSH_PORT=${SSH_PORT:-2222}
KVM=${KVM:-enable}

if [ ${ARCH} == "amd64" ]; then
QARCH="x86_64"
elif [ ${ARCH} == "arm64" ]; then
QARCH="aarch64"
else
echo "Error: No ARCH mapping exists for ${ARCH}! Exiting."; exit -1
fi

if [ ${KVM} == "enable" ]; then
KVM=",accel=kvm"
else
KVM=""
fi

if [ ${FILESYSTEM} == "none" ]; then
FILESYSTEM_ARGS=""
else
FILESYSTEM_ARGS="-virtfs local,id=hostfs,path=${FILESYSTEM},security_model=mapped,mount_tag=hostfs"
fi


if [ ${ARCH} == "amd64" ]; then
QARCH="x86_64"
QARCH_ARGS="-machine q35${KVM}"
Expand All @@ -42,8 +41,7 @@ qemu-system-${QARCH} \
${QARCH_ARGS} \
-smp cpus=${VCPUS} \
-m ${VMEM} \
${FILESYSTEM_ARGS} \
-nographic \
-drive if=virtio,format=qcow2,file=${IMAGES}/${VM_NAME}-backing.qcow2 \
-drive if=virtio,format=qcow2,file=${IMAGES}/${VM_NAME}.qcow2 \
-nic user,id=user0,model=virtio-net-pci,hostfwd=tcp::${SSH_PORT}-:22