Live Migration in OpenStack Nova with Shared Storage: A Practical Guide
Learn how to configure, execute, and verify Nova live migration when using NFS or Ceph shared storage, with a step‑by‑step example and notes on CPU compatibility and network limits.
25 Dec 2025, 05:54 UTC

Problem: Moving VMs without downtime
Operators often need to shift workloads for hardware maintenance, firmware updates, or load balancing. Stopping virtual machines is not acceptable for many services, so a technique that keeps the instance running while its compute host changes is required.
Thesis
OpenStack Nova live migration, when backed by shared storage (NFS, Ceph, etc.), can relocate a running VM with sub‑second downtime, provided the hypervisor, libvirt, CPU features, and network/storage meet specific prerequisites.
Prerequisites and configuration
- Hypervisor and libvirt: KVM/QEMU with libvirt version ≥1.2.2 on both source and destination computes.
- Shared storage: The directory
/var/lib/nova/instances(or the configuredinstances_path) must be exported via NFS or mounted from a CephFS/RBD pool and accessible with identical permissions on both hosts. - CPU compatibility: Either the hosts share the same CPU model, or Nova is configured with
cpu_mode=customand a matchingcpu_model(orcpu_mode=host-passthroughwith identical CPUs). - Nova configuration (on each compute node, typically in
/etc/nova/nova.conf):[libvirt] live_migration_flag=VIR_MIGRATE_LIVE live_migration_uri=qemu+ssh://%s/system [workarounds] disable_libvirt_liveshrink=true
On the controller, ensureallow_migrate_to_same_host=Falsein[DEFAULT].
Migration workflow overview
- Pre‑phase: Nova validates destination suitability, prepares the libvirt domain, and starts the migration thread.
- Execution phase: Memory pages are copied iteratively while tracking dirty pages; the instance disk remains on shared storage, so no disk copy is needed.
- Post‑phase: A final sync of remaining dirty pages occurs, the VM is paused briefly (<200 ms on a 1 GbE link), resumed on the destination host, and the source resources are released.
Worked example: DevStack with two computes and NFS
Where to run: Commands prefixed with [controller] are executed on the DevStack controller (or any node with nova client access). Compute‑specific commands run on the respective compute hosts with root or nova user privileges.
1. Prepare shared NFS
On a storage server, export /srv/nova_instances with rw,no_root_squash,sync. On each compute host, mount it at /var/lib/nova/instances and verify:
mount | grep /var/lib/nova/instances
2. Launch a test instance
On the controller:
nova boot --flavor m1.tiny --image cirros-0.4.0 --nic net-id=$(neutron net-list | awk '/ private / {print $2}') test-vm
Wait until nova show test-vm shows status=ACTIVE.
3. Perform live migration
Identify the destination host (e.g., compute2) and run:
nova live-migration test-vm compute2
The command returns immediately; monitor progress with:
nova show test-vm
Look for the field OS-EXT-SRV-ATTR:host changing from the source to compute2. While the migration proceeds, keep a ping running inside the VM (via nova get-vnc-console test-vm novnc or SSH) to confirm continuous connectivity.
4. Verify post‑migration
After the host field updates:
- Run
nova show test-vmand confirmOS-EXT-SRV-ATTR:hostmatches the destination. - Check that the instance’s VNC console remains responsive.
- Log into the VM and verify that application data (e.g., a file written before migration) is still present.
Trade‑offs and limitations
- CPU feature mismatches trigger a libvirt error "CPU compatibility" and abort the migration. Mitigate by standardizing CPU models or using
cpu_mode=customwith a common baseline. - Network and storage bandwidth directly affect total migration time. If the link is saturated or the storage latency is high, the dirty‑page sync may exceed the allowed downtime threshold, causing Nova to abort. Monitor with
iptables -L -v -non the migration network andiostaton the storage backend. - Post‑copy migration (available since Newton) can reduce total time under heavy load but is not enabled by default; it requires
live_migration_flag=VIR_MIGRATE_LIVE | VIR_MIGRATE_POSTCOPYand compatible libvirt/QEMU versions.
Actionable closing checklist
- Confirm shared storage is mounted with identical UUIDs on both computes.
- Verify libvirt version:
virsh --version≥1.2.2. - Ensure CPU flags match (
cat /proc/cpuinfo) or set a compatiblecpu_modeinnova.conf. - Run a low‑risk test migration (e.g., a cirros instance) and watch the host field change.
- After migration, ping the instance from an external host to validate uninterrupted connectivity.
- If migration fails, consult
/var/log/nova/nova-compute.logfor libvirt errors and address CPU or network issues before retrying.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.