Had occasion to migrate some test virtual machines from a Fedora 23 server to CentOS 7 machine today. Yeah. There are differences.
(Note that because guests on the new host would need to be accessible from other clients on my network I set up a bridge (br0) on the new server, with physical interface eth0 as one of its slaves. This would give me the flexibility in the future to define additional experimental virtual networks on the machine without compromising access to the server host.
Thought I was being clever on this one. Did an export of the machine configs to xml using:
virsh dumpxml guest1 >guest1.xml
Then I made sure all the guests on the old server were down and stayed that way:
virsh destroy guest1 virsh destroy guest2 virsh destroy guest3 virsh autostart --disable guest1 virsh autostart --disable guest2 virsh autostart --disable guest3
Then I copied those .xml files and the qcow2 disk images files from the old server to the new. Since the disk images would be located along the same exact path on the new server as they had on the old, I didn’t think I’d need to edit those .xml files.
So I went ahead and defined the first guest:
virsh define --file guest1.xml
Oh good. No errors.
virsh start guest1
Bang. An error.
error: Cannot check QEMU binary /usr/bin/qemu-kvm: No such file or directory
Oh. After Googling around a bit I had to resort to comparing the two hosts, and found that qemu-kvm is indeed under /usr/bin on Fedora 23, but on CentOS 7 it’s under /usr/libexec.
WHAAT? Really? Was it so necessary to move the executable like that? Or, better yet, to have originally located it in such an odd place?
Once I fixed the path in the .xml files to reflect the actual location of qemu-kvm on the new host, I undefined and then redefined the guest and tried starting again.
qemu-kvm: -machine pc-i440fx-2.3,accel=kvm,usb=off: Unsupported machine type
Right. Of course. Turns out guests created on CentOS 7 have the machine type “pc-i440fx-rhel7.0.0” instead of “pc-i440fx-2.3” (the “2.3” undoubtedly standing for Fedora 2-3).
A bit more editing of my .xml files, another undefine, define and start.
To make sure the guests would restart on every new boot of the underlying host I of course did a “virsh autostart guestN” for each.
You learn something new every day in the tech business. Sometimes even when you don’t want to.