hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20060427] dmesgs: NetBSD/Xen in qemu
Being a qemu-whore^W^W^Wlazy, I wanted to play with Xen, but never found the hardware to do so. Once again, qemu came to the rescue, and following the fine NetBSD/Xen howto, I managed to setup Xen in qemu.

Setup and configuration was dead easy, and NetBSD comes with some excellent infrastructure to setup a machine that starts up multiple domUs automatically, by simply adding the needed config files into /usr/pkg/etc/xen.

The qemu disk image is 1GB in size so I'll not make this available (but can upload it on request, if someone wants?), but for kicks here are dmesg outputs of the host running qemu, the Xen dom0 running inside qemu and a Xen domU domain.

Harddisk usage of the 1GB disk is, in dom0: two 180MB disk images for the domU filesystems, mounted via vnd(4). About 100MB of additional packages are installed to manage Xen plus some other things pulled in to support that (Python, Perl and lots of modules), 100MB for X, some 200MB for a full installation of NetBSD 3.0/i386 (used on the Xen kernel) which includes development and text processing environment, documentation and manpages. The rest of the disk is dedicated to swap.

The system is setup to use grub as bootloader, which offers booting either a 'regular' NetBSD/i386 kernel (i.e. no Xen), or the Xen hypervison, which then boots a NetBSD/Xen kernel, that uses the NetBSD/i386 userland to boot.

After the system has booted to multiuser mode, started the two domUs, and after logging in as root, the domU consoles can be accessed by telnetting to localhost port 9601 and 9602, respectively. Networking for the domUs is setup in the domU config files: all domUs, the dom0 plus the physical ethernet interface are all plugged into a (virtual) switch (implemented via bridge(4)), which is then bridged to the "normal" ethernet - Voila, network for all domains!

FWIW, here's what a Xen domU config file looks:

$ cat /usr/pkg/etc/xen/hf1
kernel="/netbsd-XENU"
memory=32
name="hf1"
nics=1

vif = [ 'mac=52:54:00:12:34:57, bridge=bridge0' ]

disk = [ 'file:/harddisk.xen-hf1,wd0d,w' ]
root="/dev/wd0d" 

Installation of a Xen domU with NetBSD works by creating a harddisk image, and then using the INSTALL_XENU kernel, which boots right into an installer that can then be used to install NetBSD on the disk(image). Installation sets can be fetched using the local network e.g. via FTP from dom0. Of course after setting up one domU harddisk image, setting up the other one is a mere "cp img1 img2", with some small changes for hostname and SSH keys etc.

In summary, I'm very impressed by the "roundness" of the Xen integration into NetBSD - no hacking, just add config files, disk images, and off you go.

Mmm, NetBSD!

[Tags: , , ]



Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 24535320
Copyright (c) Hubert Feyrer