Saturday, March 22, 2008

Xen vs KVM/QEMU for testing SystemImager installs

Xen is great, but for SystemImager testing I've found many advantages using KVM/QEMU.

First of all, I don't need to run all my applications in a dom0 (or domU), that means I don't have any virtualization overhead for various openoffice instances, thunderbird, firefox, kopete, lastfm, kernel builds, SystemImager builds, and all the common activities I do in my laptop. With KVM/QEMU only the guest OSes are affected by virtualization overhead (more overhead with KVM/QEMU for the I/O anyway, respect to Xen guests). In fact, from this point of view KVM/QEMU is better suited for desktop machines.

Second, to test a standard SystemImager install I always need to use the unmodified BOEL or UYOK kernel, that means to run Xen fully-virtualized guests (HVM mode) and falls back to the QEMU hardware emulated model for I/O operations, aka "QEMU device manager" (qemu-dm), a patched version of the original qemu device emulation. So, in principle, there's not a big difference respect to run guest OSes with KVM/QEMU in terms of performance.

Third, I really like the command line syntax of kvm/qemu. In principle the xm syntax of Xen is better, because it supports both a configuration file and/or command line parameters, but I always prefer the qemu syntax, probably it's because I'm more familiar with it.

And what about VMWare? Well.. I've not been able to create x86_64 guests with VMPlayer, and I've not even found anything in the web that pointed me in the right direction. I liked the NAT-only network configuration of VMPlayer, but I think I can survive also with the little more complex bridged network setup for QEMU/KVM or Xen.

Here is my network config to start a KVM/QEMU virtual machine in Ubuntu 7.10:

/etc/dbus-1/event.d/25NetworkManager stop

modprobe tun
modprobe kvm-intel

brctl addbr br0
ifconfig br0 up
ifconfig eth0 up
brctl addif br0 eth0

tunctl -b -u 1000 -t qtap0
brctl addif br0 qtap0
ifconfig qtap0 up 0.0.0.0 promisc

chmod a+rw /dev/net/tun
chmod a+rw /dev/kvm

kvm -cdrom /home/righiandr/systemimager.iso \
-hda /home/righiandr/xen/domains/Debian4/disk.img -boot d \
-m 512 -net nic,model=rtl8139 -net tap,ifname=qtap0,script=no -smp 1

NOTE: systemimager.iso is made by si_mkautoinstallcd.

No comments: