**libvirt** is an open source virtualisation management library and API that acts as a unified abstraction layer between cloud platforms and hypervisors. Rather than each cloud tool speaking directly to KVM, Xen, QEMU, or VMware, they all speak to libvirt — which translates those calls into the right hypervisor-specific commands.
---
### First Principle: Stable abstractions outlast the implementations beneath them.
libvirt's API has remained stable across years of hypervisor evolution. [[OpenStack]] Nova, and dozens of other tools all use libvirt as their compute interface. When the underlying hypervisor changes, only the libvirt driver needs updating — not every tool in the stack.
---
### Key Considerations
- **Unified API**: Supports [[KVM]]/QEMU, Xen, LXC, VMware ESX, and others through a single `virsh` CLI and C/Python/Go API.
- **Domain XML**: VM configurations are expressed as XML "domain" files — defining CPU topology, memory, disks, network interfaces, and PCI passthrough. These are human-readable and version-controllable.
- **Storage & Network Management**: libvirt manages storage pools (for VM disk images) and virtual networks (bridges, NAT, macvtap), sitting between the cloud layer and the underlying [[Open vSwitch (OVS)]] or bridge networking.
- **`virsh` CLI**: The standard tool for manual VM management — starting, stopping, inspecting, migrating, and snapshotting VMs from the command line.
- **Live Migration**: libvirt coordinates live migration of VMs between hosts, used by [[OpenStack]] Nova for workload rebalancing and maintenance.
---
### How It Fits
```
[[OpenStack]] Nova / [[KubeVirt]] (cloud orchestrator)
→ libvirt (management API)
→ [[KVM]] + QEMU (hypervisor + emulation)
→ [[Bare Metal]] (physical server)
```
[[KVM]] | [[OpenStack]] | [[KubeVirt]] | [[VMs]] | [[Open Source Hyperscaler MoC]]