15.5 Effect of Cache Modes on Live Migration

The caching of storage data and meta-data restricts the configurations which support live migration. Currently, only raw, qcow2 and qed image formats can be used for live migration. If a clustered file system is used, all cache modes support live migration. Otherwise the only cache mode which supports live migration on read/write shared storage is cache = none.

The libvirt management layer includes checks for migration compatibility based on a number of factors. If the guest storage is hosted on a clustered filesystem, is readonly or is marked sharable, then the cache mode is ignored when determining if migration can be allowed. Otherwise libvirt will not allow migration unless the cache mode is set to none. However, this restriction can be overridden with the unsafe option to the migration APIs, which is also supported by virsh, as for example in

virsh migrate --live --unsafe

HINT: cache = none is required for the IO mode setting aio = native. If another cache mode is used, then the IO mode will silently be switched back to the default aio = threads. Qemu-kvm implements the guest flush within the host by using fdatasync().