5

I tried to migrate my KVM host from a host with AMD cpu to a host with Intel CPU but when I run virsh start guest_name I got error: unsupported configuration: CPU model ... is not supported by hypervisor.

I know that KVM supports such a migration (in the FAQ they even talk about live migration between 64 bit AMD/Intel CPUs). What should I do?

ndemou
  • 1,215
  • 2
  • 16
  • 27

1 Answers1

7

You should edit the part of the xml definition of your guest so that it contains a subset of CPU capabilities that are found in both CPUs (Intel and AMD). You can use virsh to find this subset. Here's how:

At the 1st host

$ virsh capabilities | virsh cpu-baseline /dev/stdin > /tmp/host1.xml

# copy this file to Host#2 -- e.g.:
$ scp /tmp/host1.xml $HOST2:/tmp/host1.xml

Everything else happens at the 2nd host

$ virsh capabilities | virsh cpu-baseline /dev/stdin > /tmp/host2.xml
$ cat /tmp/host1.xml /tmp/host2.xml > /tmp/both-cpus.xml

Now edit both-cpus.xml and:

  1. keep only the <cpu>....</cpu> sections
  2. from these sections remove the lines with <vendor>....</vendor>

Finally run this:

$ virsh cpu-baseline /tmp/both-cpus.xml

If you get this error "XML error: Missing CPU architecture" add <arch>x86_64</arch> in both <cpu>...</cpu> sections. Ofcourse x86_64 is for modern AMD and Intel CPUs, if you work with some other architecture adjust appropriately (thanks to harald for this tip).

The output of the above command must be used inside the xml definitions of the guest.

References

ndemou
  • 1,215
  • 2
  • 16
  • 27
  • 1
    To get this to work I had to add "x86_64" to both ... sections. Otherwise, virsh cpu-baseline spat out "error: XML error: Missing CPU architecture". This is with libvirt 4.4.0 on Arch. – Harald Jul 03 '18 at 17:52
  • 1
    to get this to work I had to remove mode='custom' of cpu attribute and then add x86_64 – Golgot Jun 24 '19 at 09:03
  • It might be better to use 'source host' and 'destination host' instead of '1st host' and '2nd host.' Or 'source' and 'target.' – mr.zog Mar 13 '22 at 22:03
  • 1
    Nice idea @mr.zog. Edit my answer and I'll accept it (will also give you some points I think) – ndemou Mar 15 '22 at 08:43