Files
football/vm/template.xml
T
mrcharles 82ad3a1b6d feat: add QEMU software emulation fallback for VM testing
VM creation failed with "Emulator does not support virt type 'kvm'"
in environments without /dev/kvm (nested VMs, CI, containers). This
makes ISO boot testing work everywhere by detecting KVM at runtime.

Changes:
- vm/template.xml: replace hardcoded type='kvm' and cpu
  mode='host-passthrough' with @DOMAIN_TYPE@ and @CPU_MODE@ placeholders
- run.sh vm_create(): detect /dev/kvm at runtime, use KVM +
  host-passthrough when available, fall back to QEMU + qemu64
  software emulation when not
- tests: 6 new tests covering placeholder existence, KVM detection,
  and substitution logic

This enables the ISO to be booted and serial output captured for
verification even without hardware virtualization support.

💘 Generated with Crush

Assisted-by: GLM-4.7 via Crush <crush@charm.land>
2026-07-30 13:03:15 -05:00

53 lines
1.5 KiB
XML

<domain type='@DOMAIN_TYPE@'>
<name>@VM_NAME@</name>
<uuid>@VM_UUID@</uuid>
<memory unit='MiB'>@VM_RAM@</memory>
<currentMemory unit='MiB'>@VM_RAM@</currentMemory>
<vcpu placement='static'>@VM_CPUS@</vcpu>
<os>
<type arch='x86_64' machine='q35'>hvm</type>
<loader readonly='yes' secure='@SECURE_BOOT@' type='pflash'>@UEFI_CODE@</loader>
<nvram template='@UEFI_VARS_TEMPLATE@'/>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<smm state='on'/>
</features>
<cpu mode='@CPU_MODE@' check='none'/>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
@TPM_SECTION@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='@VM_DISK@'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='@ISO_PATH@'/>
<target dev='sda' bus='sata'/>
<readonly/>
</disk>
<interface type='user'>
<model type='virtio'/>
</interface>
<graphics type='vnc' port='-1' autoport='yes'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='virtio' heads='1' primary='yes'/>
</video>
<console type='pty'>
<target type='serial' port='0'/>
</console>
</devices>
</domain>