I recently experienced some KVM migration problems while moving virtual machines from my development laptop to my server. The laptop has a Core i7 processor but the server is running a Core i5 and, as you might expect, they have different features available. In this article I’ll explain what I did to fix my KVM migration problems.
KVM Migration Problems – Unsupported Configuration
To perform the migration I was following the steps I’ve documented here and everything was going well until I came to start the moved machine. I was presented with the error message:
virsh start main error: Failed to start domain main error: unsupported configuration: guest and host CPU are not compatible: Host CPU does not provide required features: x2apic
X2APIC, it turns out, is an interrupt controller but that’s not terribly important as the processor I’m moving too apparently doesn’t have one – erm, it has an interrupt controller obviously just not this one. When I looked in the main.xml configuration file (found in /etc/libvirt/qemu) I was surprised by how little configuration there was for the CPU:
<cpu mode='custom' match='exact'> <model fallback='allow'>SandyBridge</model> </cpu>
Now run the following command to determine what the capabilites of the target machine are – there’s quite a bit of output, CPU information is near the top:
virsh capabilities <cpu> <arch>x86_64</arch> <model>Westmere</model> <vendor>Intel</vendor> <topology sockets='1' cores='4' threads='1'/> <feature name='rdtscp'/> <feature name='avx'/> <feature name='osxsave'/> <feature name='xsave'/> <feature name='tsc-deadline'/> <feature name='pcid'/> <feature name='pdcm'/> <feature name='xtpr'/> <feature name='tm2'/> <feature name='est'/> <feature name='vmx'/> <feature name='ds_cpl'/> <feature name='monitor'/> <feature name='dtes64'/> <feature name='pclmuldq'/> <feature name='pbe'/> <feature name='tm'/> <feature name='ht'/> <feature name='ss'/> <feature name='acpi'/> <feature name='ds'/> <feature name='vme'/> </cpu>
Now that you know what model of processor is in the target host machine edit the configuration file:
virsh edit main
so that the CPU configuration looks like this (yours will probably be different):
<cpu mode='custom' match='exact'> <model fallback='allow'>Westmere</model> </cpu>
And restart your virtual machine…
Note: it’s also possible to make this change using Virtual Machine Manager. Open the virtual machine settings and under Processor > Configuration you’ll see a check box that will all you to copy the host CPU configuration.
KVM Migration Problems – Unsupported Machine Type
After fixing the CPU issue described above I then ran into this new KVM migration problem:
error: Failed to start domain main error: internal error: process exited while connecting to monitor: qemu-system-x86_64: -machine pc-i440fx-utopic,accel=kvm,usb=off: Unsupported machine type Use -machine help to list supported machines!
I initially installed this virtual machine on a host running Ubuntu 14.10 Utopic. It hadn’t occurred to me that the virtual machine would care what the host was running beyond the version of KVM / Qemu it was on. A scan though the configuration found this:
<os> <type arch='x86_64' machine='pc-i440fx-utopic'>hvm</type> <boot dev='hd'/> </os>
As above I used “virsh edit main” to modify the configuration and changed “utopic” to “trusty” which is what the server is running. This was enough to get the virtual machine started.