-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental ubuntu2204-wpt profile
- Loading branch information
Showing
11 changed files
with
280 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env zsh | ||
# usage: ubuntu2204/build-image.sh <snapshot_name> | ||
image_dir=${0:a:h} | ||
script_dir=${0:a:h}/.. | ||
. "$script_dir/common.sh" | ||
trap print_undo_commands EXIT | ||
. "$script_dir/download.sh" | ||
. "$script_dir/inject.sh" | ||
undo_commands=$(mktemp) | ||
image_name=servo-ubuntu2204-wpt | ||
snapshot_name=$1; shift | ||
|
||
>&2 echo '[*] Caching downloads' | ||
download "$SERVO_CI_CACHE_PATH" https://cloud-images.ubuntu.com/jammy/20241217/jammy-server-cloudimg-amd64.img 0d8345a343c2547e55ac815342e6cb4a593aa5556872651eb47e6856a2bb0cdd | ||
|
||
>&2 echo '[*] Converting qcow2 image to raw image' | ||
qemu-img convert -f qcow2 -O raw "$SERVO_CI_CACHE_PATH/jammy-server-cloudimg-amd64.img" "$SERVO_CI_CACHE_PATH/jammy-server-cloudimg-amd64.raw" | ||
|
||
>&2 echo '[*] Creating zvol (if needed)' | ||
zfs list -Ho name "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" || zfs create -V 90G "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" | ||
|
||
>&2 echo '[*] Creating libvirt guest (or recreating it with new config)' | ||
if virsh domstate -- "$image_name"; then | ||
virsh destroy -- "$image_name" || : # FIXME make this idempotent in a less noisy way? | ||
virsh undefine -- "$image_name" | ||
fi | ||
virsh define -- "$image_dir/guest.xml" | ||
virt-clone --preserve-data --check path_in_use=off -o "$image_name.init" -n "$image_name" -f "/dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" | ||
virsh undefine -- "$image_name.init" | ||
|
||
>&2 echo '[*] Wiping zvol' | ||
dd bs=1M count=1 if=/dev/zero of="/dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" | ||
|
||
>&2 echo '[*] Writing disk images' | ||
dd status=progress bs=1M if="$SERVO_CI_CACHE_PATH/jammy-server-cloudimg-amd64.raw" of="/dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" | ||
genisoimage -V CIDATA -R -f -o "/var/lib/libvirt/images/$image_name.config.iso" "$image_dir/user-data" "$image_dir/meta-data" | ||
|
||
>&2 echo '[*] Starting guest, to expand root filesystem' | ||
virsh start "$image_name" | ||
|
||
>&2 echo '[*] Waiting for guest to shut down (max 40 seconds)' # normally ~19 seconds | ||
if ! time virsh event --timeout 40 -- "$image_name" lifecycle; then | ||
>&2 echo 'virsh event timed out!' | ||
exit 1 | ||
fi | ||
|
||
>&2 echo '[*] Forcing update of partition block device geometry' | ||
# Dec 20 17:12:59 jupiter kernel: EXT4-fs (zd16p1): bad geometry: block count 23564539 exceeds size of device (548091 blocks) | ||
blockdev --rereadpt "/dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$image_name" | ||
sleep 1 | ||
|
||
>&2 echo '[*] Waiting for partition block device to appear' | ||
partition_block_device=/dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$image_name-part1 | ||
t=0; while ! test -e $partition_block_device; do | ||
if [ $t -ge $SERVO_CI_ZVOL_BLOCK_DEVICE_TIMEOUT ]; then | ||
>&2 printf '[!] Timed out waiting for block device: %s' $partition_block_device | ||
exit 1 | ||
fi | ||
sleep 1 | ||
t=$((t+1)) | ||
done | ||
|
||
>&2 echo '[*] Configuring base image' | ||
./mount-runner.sh "$image_name" "$image_dir/configure-base.sh" | ||
|
||
>&2 echo '[*] Starting guest, to apply changes' | ||
virsh start "$image_name" | ||
|
||
>&2 echo '[*] Waiting for guest to shut down (max 2000 seconds)' # normally ~978 seconds | ||
if ! time virsh event --timeout 2000 -- "$image_name" lifecycle; then | ||
>&2 echo 'virsh event timed out!' | ||
exit 1 | ||
fi | ||
|
||
>&2 echo '[*] Checking that Servo was built correctly' | ||
./mount-runner.sh "$image_name" sh -c 'ls init/built_servo_once_successfully' | ||
|
||
>&2 echo "[*] Taking zvol snapshot: $SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" | ||
zfs snapshot "$SERVO_CI_ZFS_CLONE_PREFIX/$image_name@$snapshot_name" | ||
|
||
>&2 echo '[*] Done!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/configure-base.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/configure-runner.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
<domain type='kvm'> | ||
<name>servo-ubuntu2204-wpt.init</name> | ||
<uuid>ec747b67-ffb4-47cc-a27b-43156ca1724f</uuid> | ||
<metadata> | ||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0"> | ||
<libosinfo:os id="http://ubuntu.com/ubuntu/22.04"/> | ||
</libosinfo:libosinfo> | ||
</metadata> | ||
<memory unit='KiB'>12582912</memory> | ||
<currentMemory unit='KiB'>12582912</currentMemory> | ||
<memoryBacking> | ||
<hugepages/> | ||
</memoryBacking> | ||
<vcpu placement='static'>8</vcpu> | ||
<os> | ||
<type arch='x86_64' machine='pc-q35-8.1'>hvm</type> | ||
</os> | ||
<features> | ||
<acpi/> | ||
<apic/> | ||
<vmport state='off'/> | ||
</features> | ||
<cpu mode='host-passthrough' check='none' migratable='on'/> | ||
<clock offset='utc'> | ||
<timer name='rtc' tickpolicy='catchup'/> | ||
<timer name='pit' tickpolicy='delay'/> | ||
<timer name='hpet' present='no'/> | ||
</clock> | ||
<on_poweroff>destroy</on_poweroff> | ||
<on_reboot>restart</on_reboot> | ||
<on_crash>destroy</on_crash> | ||
<pm> | ||
<suspend-to-mem enabled='no'/> | ||
<suspend-to-disk enabled='no'/> | ||
</pm> | ||
<devices> | ||
<emulator>/run/libvirt/nix-emulators/qemu-system-x86_64</emulator> | ||
<disk type='block' device='disk'> | ||
<driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/> | ||
<!-- virt-clone(1) will replace this with the first `-f` --> | ||
<source dev='/dev/null'/> | ||
<target dev='vda' bus='virtio'/> | ||
<boot order='1'/> | ||
<address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/> | ||
</disk> | ||
<disk type='file' device='cdrom'> | ||
<driver name='qemu' type='raw'/> | ||
<source file='/var/lib/libvirt/images/servo-ubuntu2204-wpt.config.iso'/> | ||
<target dev='sda' bus='sata'/> | ||
<readonly/> | ||
<boot order='2'/> | ||
<address type='drive' controller='0' bus='0' target='0' unit='0'/> | ||
</disk> | ||
<controller type='usb' index='0' model='qemu-xhci' ports='15'> | ||
<address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> | ||
</controller> | ||
<controller type='pci' index='0' model='pcie-root'/> | ||
<controller type='pci' index='1' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='1' port='0x10'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/> | ||
</controller> | ||
<controller type='pci' index='2' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='2' port='0x11'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/> | ||
</controller> | ||
<controller type='pci' index='3' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='3' port='0x12'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/> | ||
</controller> | ||
<controller type='pci' index='4' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='4' port='0x13'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/> | ||
</controller> | ||
<controller type='pci' index='5' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='5' port='0x14'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/> | ||
</controller> | ||
<controller type='pci' index='6' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='6' port='0x15'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/> | ||
</controller> | ||
<controller type='pci' index='7' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='7' port='0x16'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/> | ||
</controller> | ||
<controller type='pci' index='8' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='8' port='0x17'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x7'/> | ||
</controller> | ||
<controller type='pci' index='9' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='9' port='0x18'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/> | ||
</controller> | ||
<controller type='pci' index='10' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='10' port='0x19'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/> | ||
</controller> | ||
<controller type='pci' index='11' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='11' port='0x1a'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/> | ||
</controller> | ||
<controller type='pci' index='12' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='12' port='0x1b'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/> | ||
</controller> | ||
<controller type='pci' index='13' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='13' port='0x1c'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x4'/> | ||
</controller> | ||
<controller type='pci' index='14' model='pcie-root-port'> | ||
<model name='pcie-root-port'/> | ||
<target chassis='14' port='0x1d'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x5'/> | ||
</controller> | ||
<controller type='sata' index='0'> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> | ||
</controller> | ||
<controller type='virtio-serial' index='0'> | ||
<address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> | ||
</controller> | ||
<interface type='network'> | ||
<mac address='52:54:00:b8:b3:dd'/> | ||
<source network='cinet'/> | ||
<model type='virtio'/> | ||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> | ||
</interface> | ||
<serial type='pty'> | ||
<target type='isa-serial' port='0'> | ||
<model name='isa-serial'/> | ||
</target> | ||
</serial> | ||
<console type='pty'> | ||
<target type='serial' port='0'/> | ||
</console> | ||
<channel type='unix'> | ||
<target type='virtio' name='org.qemu.guest_agent.0'/> | ||
<address type='virtio-serial' controller='0' bus='0' port='1'/> | ||
</channel> | ||
<channel type='spicevmc'> | ||
<target type='virtio' name='com.redhat.spice.0'/> | ||
<address type='virtio-serial' controller='0' bus='0' port='2'/> | ||
</channel> | ||
<input type='tablet' bus='usb'> | ||
<address type='usb' bus='0' port='1'/> | ||
</input> | ||
<input type='mouse' bus='ps2'/> | ||
<input type='keyboard' bus='ps2'/> | ||
<graphics type='spice' autoport='yes'> | ||
<listen type='address'/> | ||
<image compression='off'/> | ||
</graphics> | ||
<sound model='ich9'> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/> | ||
</sound> | ||
<audio id='1' type='spice'/> | ||
<video> | ||
<model type='virtio' heads='1' primary='yes'/> | ||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> | ||
</video> | ||
<redirdev bus='usb' type='spicevmc'> | ||
<address type='usb' bus='0' port='2'/> | ||
</redirdev> | ||
<redirdev bus='usb' type='spicevmc'> | ||
<address type='usb' bus='0' port='3'/> | ||
</redirdev> | ||
<watchdog model='itco' action='reset'/> | ||
<memballoon model='virtio'> | ||
<address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/> | ||
</memballoon> | ||
<rng model='virtio'> | ||
<backend model='random'>/dev/urandom</backend> | ||
<address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/> | ||
</rng> | ||
</devices> | ||
</domain> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/init.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/meta-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/register-runner.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/user-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu2204/virt-clone.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters