Live migrationΒΆ
If the host capabilities used by the VM on host 1 are also present on host 2, you can perform a live migration from host 1 to host 2.
Choose carefully all XML tags related to the host architecture (<vcpu>
,
<cputune>
, <cpu>
, and so on).
For <cpu>
XML tags, use the mode="host-model"
option only if all hosts are
strictly identical.
Note
To get common capabilities between hosts, use the
virsh
capabilities
orcpu-baseline
commands.Example
We will get common capabilities between a Sandybridge host and a Westmere host.
On the first host (Sandybridge), get the CPU capabilities:
$ virsh capabilities > host1.xml
On the second host (Westmere), get the common capabilities between the two hosts to set in the
<cpu>
XML tag:$ virsh cpu-baseline host1.xml <cpu mode='custom' match='exact'> <model fallback='forbid'>Westmere</model> <vendor>Intel</vendor> <feature policy='require' name='invtsc'/> <feature policy='require' name='rdtscp'/> <feature policy='require' name='pdpe1gb'/> <feature policy='require' name='dca'/> <feature policy='require' name='pcid'/> <feature policy='require' name='pdcm'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='tm2'/> <feature policy='require' name='est'/> <feature policy='require' name='smx'/> <feature policy='require' name='vmx'/> <feature policy='require' name='ds_cpl'/> <feature policy='require' name='monitor'/> <feature policy='require' name='dtes64'/> <feature policy='require' name='pclmuldq'/> <feature policy='require' name='pbe'/> <feature policy='require' name='tm'/> <feature policy='require' name='ht'/> <feature policy='require' name='ss'/> <feature policy='require' name='acpi'/> <feature policy='require' name='ds'/> <feature policy='require' name='vme'/> </cpu>
Migration may fail due to restrictions on which flags can be migrated. In
the example above, we must remove the invtsc
feature, since it cannot be
migrated.
The following patch solves this issue, but it is not integrated in
libvirt
yet:
http://www.redhat.com/archives/libvir-list/2015-March/msg01521.html
You can migrate a VM from host 1 to host 2, via virsh migrate
:
$ virsh migrate $domain_name --live \
qemu+ssh://$name_or_address_of_host2/system \
tcp://$name_or_address_of_host2