PV and PVH Guests

Paravirtualized (PV) and PVH guests use a direct interface to the Xen hypervisor rather than emulated hardware. This makes them fast and efficient, but requires a guest kernel with Xen support (which all modern Linux kernels include).

PVH is the recommended mode for new Linux guests on hardware that supports it. If your toolstack and kernel support PVH, prefer it over pure PV.

Creating a PVH guest

A guest is defined by a configuration file, typically placed in /etc/xen/. Here is a minimal PVH configuration:

type = "pvh"
name = "myguest"
memory = 512
vcpus = 2
kernel = "/boot/vmlinuz"
ramdisk = "/boot/initrd.img"
extra = "root=/dev/xvda1 ro console=hvc0"
disk = [ "phy:/dev/vg0/myguest,xvda,w" ]
vif = [ "bridge=xenbr0" ]

Save this as /etc/xen/myguest.cfg and start the guest:

xl create /etc/xen/myguest.cfg

Boot methods

The example above points kernel/ramdisk at files on dom0, which means updating the guest’s kernel means updating those paths too. The alternative is pygrub, which reads the bootloader configuration from inside the guest’s own filesystem instead, so kernel upgrades inside the guest work the same way they would on real hardware:

bootloader = "pygrub"

Omit kernel and ramdisk when using bootloader. This is the more common approach once a guest is past initial setup.

Configuration reference

type

Set to pvh for PVH guests, or omit for PV (default when kernel is specified and no type is set).

name

A unique name for this guest.

memory

RAM allocated to the guest, in megabytes.

vcpus

Number of virtual CPUs.

kernel

Path to the guest kernel image on dom0.

ramdisk

Path to the initial ramdisk image (optional but usually needed).

extra

Kernel command line arguments.

disk

Disk devices. Format: "source,target,access". Common sources include physical devices (phy:) and file-backed images (file:).

vif

Virtual network interfaces. bridge= specifies the dom0 bridge to connect to.

See the xl.cfg(5) man page for the full list of configuration options.