KVM and Libvirt
KVM/libvirt model
Purpose
Describe how the Virtualization Agent discovers VMs and interfaces on a KVM/libvirt host, and which APIs operators use to inspect that inventory.
Audience
Hypervisor operators who expect VM names and TAP/bridge topology in the Manager.
Edition
SHARED. Agent upload POST /api/v1/virtualization/vm-data uses Agent JWT plus virtualization capability.
Status
SUPPORTED for KVM/libvirt. Kubernetes is planned, not shipping. Other hypervisors are not shipping integrations.
Prerequisites
- libvirt reachable at the configured URI
virtualization.enabled: trueon the Agentvirtualization.platform: kvm- Agent running as root (typical
qemu:///system)
Required permissions
Host: membership/access consistent with qemu:///system (the unit runs as root). Manager: admin for inventory GETs.
Dependencies
libvirt. Example URI qemu:///system. qemu:///session and qemu+ssh://… appear as comments in the example; they are not a certified remote-libvirt product.
Configuration
From configs/agent.example.yml:
Scroll sideways to see the full table. Use the arrow keys when focused.
| Key | Example | Notes |
|---|---|---|
virtualization.enabled | example false | set true on the KVM host |
virtualization.platform | kvm | current shipping value |
virtualization.libvirt.uri | qemu:///system | typical |
virtualization.libvirt.read_only | false | read-only cannot modify VMs, only discover |
virtualization.discovery.interval | 30s | |
virtualization.discovery.cache_ttl | 60s | |
virtualization.events.enabled | true | domain start/stop |
virtualization.events.auto_apply_rules | true | apply firewall rules when a VM starts |
agent.vm_bridge_name | viifbr0 | example bridge for TAP/XDP/TC topology discovery — not a required global name |
Traffic collection excludes many virtual NICs by default (lo, veth*, docker*, virbr*, viifbr*, viif*, vnet*, tap*, tun*, …). That filter is for accounting, not a claim that XDP never attaches to VM taps. Do not double-count bridge mirrors.
Procedure
- Install libvirt/KVM as you already operate it. Zwall does not replace libvirt.
- Set
virtualization.enabled: trueandlibvirt.uri: qemu:///system. - Set
agent.vm_bridge_nameto your VM bridge if you use that discovery path. - Restart
zwall-agent. - Confirm the Agent posts VM data and the Manager lists it.
Admin inventory:
GET /api/v1/virtualization/vmsGET /api/v1/virtualization/vms/:vm_idGET /api/v1/virtualization/vms/:vm_id/rulesGET /api/v1/virtualization/vms/:vm_id/interfacesGET /api/v1/virtualization/interfacesGET /api/v1/virtualization/interfaces/:nameGET /api/v1/virtualization/interfaces/:name/statsGET /api/v1/virtualization/summaryPOST /api/v1/virtualization/discovery(license-gated writes on Enterprise)
Agent: POST /api/v1/virtualization/vm-data.
Do not invent VMware/Hyper-V fields.
Verification
On a libvirt host that has workloads, VM and interface lists are non-empty. An empty list on a host with no domains is expected. Console virtualization pages should match virsh list --all at a coarse level (names/interfaces), not as a second hypervisor.
Expected result
Manager shows KVM domains and interfaces the Agent discovered. Packet policy still comes from Manager rules assigned to the Agent, not from libvirt network XML.
Failure modes
Scroll sideways to see the full table. Use the arrow keys when focused.
| Symptom | Cause | Action |
|---|---|---|
| No VMs | virtualization.enabled false; not KVM; wrong URI | enable; qemu:///system; confirm libvirt |
| Wrong topology | vm_bridge_name does not match the host | set the real bridge |
| Discovery 403/license | Enterprise license gate on writes | inventory GETs may still work |
| Hosting node empty | Hosting profile rejects virtualization features | use a Virtualization Agent |
Troubleshooting
journalctl -u zwall-agent for libvirt connect errors. virsh -c qemu:///system list --all independently of Zwall.
Security considerations
- Prefer read-only libvirt if you only need inventory and your process allows it.
- VM data uploaded to the Manager is operational inventory, not a reason to expose libvirt on the network.
Limitations
- KVM/libvirt only as a shipping integration.
- Kubernetes NOT_SUPPORTED.
- Example
viifbr0is not mandatory. - Hardware sizing is not certified.