Add comprehensive XML generation tests covering: multi-disk VMs, multi-NIC configurations, MAC addresses, boot order, memory conversion, sequential disk naming, custom storage pools, NAT/route/isolated networks, volume sizing, builder defaults, q35 machine type, and serial console. Add kvm-vm-examples binary with 5 scenarios: - alpine: minimal 512MB VM, fast boot for testing - ubuntu: standard server with 25GB disk - worker: multi-disk (60G OS + 2x100G Ceph OSD) for storage nodes - gateway: dual-NIC (WAN NAT + LAN isolated) for firewall/router - ha-cluster: full 7-VM deployment (gateway + 3 CP + 3 workers) Each scenario has clean and status subcommands. 19 KVM unit tests pass (17 new + 2 existing). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.4 KiB
Markdown
48 lines
1.4 KiB
Markdown
# KVM VM Examples
|
|
|
|
Demonstrates creating VMs with various configurations using harmony's KVM module. These examples exercise the same infrastructure primitives needed for the full OKD HA cluster with OPNsense, control plane, and workers with Ceph.
|
|
|
|
## Prerequisites
|
|
|
|
A working KVM/libvirt setup:
|
|
|
|
```bash
|
|
# Manjaro / Arch
|
|
sudo pacman -S qemu-full libvirt virt-install dnsmasq ebtables
|
|
sudo systemctl enable --now libvirtd
|
|
sudo usermod -aG libvirt $USER
|
|
# Log out and back in for group membership to take effect
|
|
```
|
|
|
|
## Scenarios
|
|
|
|
| Scenario | VMs | Disks | NICs | Purpose |
|
|
|----------|-----|-------|------|---------|
|
|
| `alpine` | 1 | 1x2G | 1 | Minimal VM, fast boot (~5s) |
|
|
| `ubuntu` | 1 | 1x25G | 1 | Standard server setup |
|
|
| `worker` | 1 | 3 (60G+100G+100G) | 1 | Multi-disk for Ceph OSD |
|
|
| `gateway` | 1 | 1x10G | 2 (WAN+LAN) | Dual-NIC firewall |
|
|
| `ha-cluster` | 7 | mixed | 1 each | Full HA: gateway + 3 CP + 3 workers |
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Deploy a scenario
|
|
cargo run -p kvm-vm-examples -- alpine
|
|
cargo run -p kvm-vm-examples -- ubuntu
|
|
cargo run -p kvm-vm-examples -- worker
|
|
cargo run -p kvm-vm-examples -- gateway
|
|
cargo run -p kvm-vm-examples -- ha-cluster
|
|
|
|
# Check status
|
|
cargo run -p kvm-vm-examples -- status alpine
|
|
|
|
# Clean up
|
|
cargo run -p kvm-vm-examples -- clean alpine
|
|
```
|
|
|
|
## Environment variables
|
|
|
|
- `HARMONY_KVM_URI`: libvirt URI (default: `qemu:///system`)
|
|
- `HARMONY_KVM_IMAGE_DIR`: where disk images and ISOs are stored
|