Skip to content

Commit daa903d

Browse files
committed
bootc-ubuntu-setup: Use fixed QEMU from Resolute
The Plucky QEMU used on Noble lacks the synchronous vhost-user notifier update needed to avoid lost virtiofs interrupts. Select Resolute's fixed emulator for virtualization jobs, including its matching iPXE ROM package so guests can actually boot. Keep this limited to Ubuntu 24.04 disposable runners: the package transaction also upgrades runtime dependencies. Exercise stock CentOS Stream 9 guest boot and SSH on both runner architectures without rebuilding an OS image. Generated-by: AI
1 parent 6e34e8e commit daa903d

2 files changed

Lines changed: 208 additions & 0 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Test virtualization setup
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- bootc-ubuntu-setup/action.yml
7+
- .github/workflows/test-virtualization.yml
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
qemu-smoke:
15+
name: QEMU virtiofs smoke test
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- runner: ubuntu-24.04
21+
architecture: amd64
22+
- runner: ubuntu-24.04-arm
23+
architecture: arm64
24+
runs-on: ${{ matrix.runner }}
25+
timeout-minutes: 25
26+
steps:
27+
- name: Checkout actions
28+
uses: actions/checkout@v7
29+
with:
30+
persist-credentials: false
31+
32+
- name: Set up Ubuntu host
33+
uses: ./bootc-ubuntu-setup
34+
with:
35+
libvirt: true
36+
37+
- name: Verify host QEMU and KVM
38+
shell: bash
39+
run: |
40+
set -euo pipefail
41+
qemu="qemu-system-$(uname -m)"
42+
"$qemu" --version
43+
test -r /dev/kvm -a -w /dev/kvm
44+
if [ "$(uname -m)" = x86_64 ]; then
45+
"$qemu" -machine help | grep -Eq '(^|[[:space:]])q35([[:space:]]|$)'
46+
else
47+
"$qemu" -machine help | grep -Eq '(^|[[:space:]])virt([[:space:]]|$)'
48+
fi
49+
50+
- name: Pull smoke image
51+
shell: bash
52+
run: |
53+
set -euo pipefail
54+
image=quay.io/centos-bootc/centos-bootc:stream9
55+
timeout --foreground --signal=TERM --kill-after=30s 5m podman pull -q "$image"
56+
podman image inspect "$image" --format '{{.RepoDigests}}' >"$RUNNER_TEMP/image-digest.txt"
57+
58+
- name: Run ephemeral VM
59+
shell: bash
60+
run: |
61+
set -euo pipefail
62+
artifact_dir="$RUNNER_TEMP/qemu-smoke"
63+
log_dir="$artifact_dir/vm-logs"
64+
name="qemu-smoke-${GITHUB_RUN_ID}"
65+
mkdir -p "$log_dir"
66+
limit_log() {
67+
local log=$1
68+
if [ -f "$log" ] && [ "$(stat -c %s "$log")" -gt 5242880 ]; then
69+
truncate --size=5242880 "$log"
70+
fi
71+
}
72+
# shellcheck disable=SC2317 # invoked by the EXIT trap below
73+
cleanup() {
74+
timeout --foreground --signal=TERM --kill-after=5s 20s podman stop --time 20 "$name" >/dev/null 2>&1 || :
75+
timeout --foreground --signal=TERM --kill-after=5s 10s podman rm -f "$name" >/dev/null 2>&1 || :
76+
}
77+
trap cleanup EXIT
78+
79+
set +e
80+
timeout --foreground --signal=TERM --kill-after=10s 90s \
81+
bcvk ephemeral run -d -K --name "$name" --console \
82+
--log-dir "journal,console=$log_dir" \
83+
quay.io/centos-bootc/centos-bootc:stream9 \
84+
>"$artifact_dir/launcher.log" 2>&1
85+
launcher_status=$?
86+
main_status=$launcher_status
87+
if [ "$launcher_status" -eq 0 ]; then
88+
deadline=$((SECONDS + 90))
89+
main_status=1
90+
while [ "$SECONDS" -lt "$deadline" ]; do
91+
if timeout --foreground --signal=TERM --kill-after=2s 10s \
92+
bcvk ephemeral ssh "$name" 'uname -a && true' \
93+
>"$artifact_dir/guest-command.log" 2>&1; then
94+
ssh_status=0
95+
else
96+
ssh_status=$?
97+
fi
98+
if [ "$ssh_status" -eq 0 ] && grep -Eq '^Linux ' "$artifact_dir/guest-command.log"; then
99+
main_status=0
100+
break
101+
fi
102+
sleep 2
103+
done
104+
fi
105+
printf '%s\n' "$launcher_status" >"$artifact_dir/launcher-exit-status.txt"
106+
printf '%s\n' "$main_status" >"$artifact_dir/main-exit-status.txt"
107+
timeout --foreground --signal=TERM --kill-after=5s 10s podman logs "$name" >"$artifact_dir/container.log" 2>&1 || :
108+
limit_log "$artifact_dir/launcher.log"
109+
limit_log "$artifact_dir/container.log"
110+
for log in "$log_dir"/journal.json "$log_dir"/journal-initrd.json "$log_dir"/console.txt; do
111+
limit_log "$log"
112+
done
113+
exit "$main_status"
114+
115+
- name: Upload smoke diagnostics
116+
if: always()
117+
uses: actions/upload-artifact@v7
118+
with:
119+
name: qemu-virtiofs-smoke-${{ matrix.architecture }}
120+
path: |
121+
${{ runner.temp }}/qemu-smoke
122+
${{ runner.temp }}/image-digest.txt
123+
retention-days: 7

‎bootc-ubuntu-setup/action.yml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,91 @@ runs:
123123
124124
# Also bump the default fd limit as a workaround for https://github.com/bootc-dev/bcvk/issues/65
125125
sudo sed -i -e 's,^\* hard nofile 65536,* hard nofile 524288,' /etc/security/limits.conf
126+
# Ubuntu 24.04's QEMU loses virtiofs IRQ notifications. Use the fixed
127+
# package from Resolute on Ubuntu 24.04 for the disposable CI host; the
128+
# Ubuntu 26.04 setup may provide its own native stack. This is the same
129+
# race investigated in https://github.com/bootc-dev/bootc/pull/2290:
130+
# https://github.com/qemu/qemu/commit/1ba9a5220325dd5260a0c37b6299ce38364a5120
131+
- name: Install fixed QEMU from Ubuntu Resolute
132+
if: ${{ inputs.libvirt == 'true' }}
133+
shell: bash
134+
run: |
135+
set -xeuo pipefail
136+
idv=$(. /usr/lib/os-release && printf '%s-%s' "$ID" "$VERSION_ID")
137+
if [ "$idv" != ubuntu-24.04 ]; then
138+
printf 'Skipping Resolute QEMU setup on %s\n' "$idv"
139+
exit 0
140+
fi
141+
case "$(dpkg --print-architecture)" in
142+
amd64)
143+
qemu_package=qemu-system-x86
144+
;;
145+
arm64)
146+
qemu_package=qemu-system-arm
147+
;;
148+
*)
149+
printf 'Unsupported architecture for Resolute QEMU: %s\n' \
150+
"$(dpkg --print-architecture)" >&2
151+
exit 1
152+
;;
153+
esac
154+
qemu_binary="qemu-system-$(uname -m)"
155+
156+
# Keep Resolute below the normal candidate for every package. The
157+
# explicitly requested QEMU packages still bring their dependency
158+
# closure (including glibc 2.43); that is acceptable on this
159+
# disposable CI runner; copying just the executable would leave its
160+
# runtime libraries behind.
161+
printf '%s\n' \
162+
'Package: *' \
163+
'Pin: release n=resolute' \
164+
'Pin-Priority: 50' | sudo tee /etc/apt/preferences.d/resolute-qemu >/dev/null
165+
166+
if [ "$(dpkg --print-architecture)" = amd64 ]; then
167+
if [ -f /etc/apt/apt-mirrors.txt ]; then
168+
mirror='mirror+file:/etc/apt/apt-mirrors.txt'
169+
else
170+
mirror='http://archive.ubuntu.com/ubuntu'
171+
fi
172+
else
173+
mirror='http://ports.ubuntu.com/ubuntu-ports'
174+
fi
175+
printf 'deb %s resolute main universe\n' "$mirror" | \
176+
sudo tee /etc/apt/sources.list.d/resolute-qemu.list >/dev/null
177+
timeout --foreground --signal=TERM --kill-after=30s 5m sudo apt-get update
178+
179+
# Keep ipxe-qemu in this explicit target transaction: its ROM must
180+
# match the QEMU userspace rather than the older package from Plucky.
181+
timeout --foreground --signal=TERM --kill-after=30s 5m \
182+
sudo apt-get -t resolute install -y --no-install-recommends \
183+
"$qemu_package" qemu-system-common qemu-system-data qemu-utils ipxe-qemu
184+
185+
printf 'Selected QEMU: %s\n' "$qemu_binary"
186+
"$qemu_binary" --version
187+
dpkg-query -W -f='${binary:Package} ${Version}\n' \
188+
"$qemu_package" qemu-system-common qemu-system-data qemu-utils ipxe-qemu
189+
rom=
190+
if [ "$(dpkg --print-architecture)" = amd64 ]; then
191+
rom_names=(efi-virtio.rom)
192+
else
193+
rom_names=(efi-aa64.rom efi-virtio.rom)
194+
fi
195+
for rom_name in "${rom_names[@]}"; do
196+
for candidate in "/usr/share/qemu/$rom_name" "/usr/lib/ipxe/qemu/$rom_name"; do
197+
if [ -f "$candidate" ]; then
198+
rom=$candidate
199+
break
200+
fi
201+
done
202+
[ -n "$rom" ] && break
203+
done
204+
if [ -n "$rom" ]; then
205+
printf 'EFI ROM: %s (%s)\n' "$rom" "$(dpkg-query -S "$rom")"
206+
sha256sum "$rom"
207+
else
208+
printf 'No expected EFI ROM found after installing ipxe-qemu\n' >&2
209+
exit 1
210+
fi
126211
- name: Cleanup status
127212
shell: bash
128213
run: |

0 commit comments

Comments
 (0)