technical quirks & misc

converting a VirtualBox image to a libvirt

motivation

i have a gentoo system inside a virtualbox but i wanted to make some ‘long term tests’ so i decided to migrate it to a libvirt machine which is running ‘fedora core 15 beta’.

problems converting the image

first i tried to migrate the ‘Gentoo 64 (portage).vdi’ directly to a libvirt image, using [2]. but anything i tried: afterwards the image was never bootable so i decided to use ssh to copy all the files instead.

boot both virtual machines using the ‘grml64-mediaum_2010.12.iso‘.

assign the ip addresses
while i was using on the virtualbox side using: vboxnet0 in a host only networking schema i used a bridge on the other machine which involved lots of manual configuration as: disable networkmanager (on fedora core, remember?), removing the eth0 configuration (which happens to be called em1); adding a new configuration for the bridge br0 (using eth0).

finally i could ping from the virtualbox image to the libvirt guest system

i used ‘rsync -av /mnt/gentoo -e ssh 192.168.66.20:/mnt/gentoo‘
Note: both local gentoo systems were mounted into /mnt/gentoo

but libvirt used a ide host controller (which was very slow)
therefore i manually removed the ide controller and replaced it by a VirtIO Disk using ‘qcow2′ as storage format and ‘Virtio’ as bus.

after all the copying i installed grub (grub-1.99rc1) but the original system had a grub1 config!
the conversion was not simple!

the kernel configuration pitfall

a libvirt guest must be aware of /dev/vda (virtIO) but my genkernel was not. also i lacked ext4 support. so it is a good idea to included this into the kernel (i had it included as modules but it did not work well).

just use ‘genkernel’ to build the new kernel (and don’t forget the ext4 support as i did).

fedora core network problems

i basically used [3] to make it work. the benefit is now that em1 is not used directly but the system uses br0 to access the internet.

PRO: the libvirt guests do get their own ‘mac address’, thus are separated from being able to see each others traffic.

fedora core yum problems

i also tried to install virtualbox and followed the instructions found on virtualbox.org but soon i had the problem that the virtualbox kernel modules won’t build and need ‘kernel-devel’ but after installing the kernel-devel package using ‘yum install kernel-devel’ there was a mismatch between ‘used kernel’ and ‘kernel-devel’ headers.

summary

libvirt and the ‘virtual machine manager’ are very nice:

i like that it is so easy to start a virtual machine when the host machine boots.

i also like the ‘virtual machine manager’ as it shows cpu/disk io/network io nicely
(but that is not limited to libvirt virtualizations).

fedora core 15 beta was running quite nicely (except that it crashed while i was writing this article)
so i can at least say: it ran for straight 6hours without crash ;P