Xen for dummies - part1
By Chris W Beal on Jul 17, 2006
I've been helping out the Xen team to try out the bits they've put on OpenSolaris over the last week or two. I've been impressed with how much they've got working so far, but as an experienced Solaris user who is new to Xen I've found it quite hard to get my head around what Xen does and how it works.
First off install it using the instructions on OpenSolaris and then you need to get some domains set up.
So boot up under Xen. You'll see from the grub menu (/boot/grub/menu.lst) some things have changed. Instead of booting a Solaris kernel, you boot xen which then loads a solaris kernel in the module line.
title Solaris on Xen 64-bit
kernel /boot/amd64/xen.gz dom0_mem=524288 console=com1 com1=9600,8n1
module /platform/i86xen/kernel/amd64/unix /platform/i86xen/kernel/amd64/unix -k
Note the option dom0_mem=524288. This assigne 512Mb to your Dom0 at startup.
Another thing to note is that even booting on metal (ie not booting the xen hypervisor first) we no longer use multiboot, but can boot our unix directley.
title Solaris Nevada snv_41 X86
Read Joe Bonasera's blog about why this is the case.
OK so you've got Solaris booted on Xen. This is refered to as Dom0 you need to set up some more instances of Solaris (or whatever Xen compatible OS you happen to want) and that is refered to as a DomU.
Each DomU has it's own full OS install so for solaris we set up a flar archive and use the vbdcfg script to help us convert that in to a OS instance Xen can boot as a DomU. This is all described here.
A couple of things to think about. Networking is bridged (ie it appears to be directly connected to the outside world) so you're going to need to give it a real IP address or use DHCP (this can be decided as the DomU boots up). Also you need to give it an ethernet address using the -e flag to vbdcfg. As this is a made up ethernet addess I don't know how you're supposed to create it, Dave Edmondson suggested making the first octet 0xaa and encoding the IP address in the rest of it.
So when you've got your DomU setup using vbdcfg what do you get?
Well in /export/xc/xvm you'll have a directory for your DomU domain
-rw-r--r-- 1 root root 379 Jul 12 09:57 mydomU-64.py
-rw-r--r-- 1 root root 367 Jul 12 09:57 mydomU.py
drwxr-xr-x 4 root root 512 Jul 12 09:48 platform
-rw-r--r-- 1 root root 19 Jul 12 09:48 root.dev
drwxr-xr-x 2 root root 512 Jul 12 09:48 vmnt
the .py files are python scripts used to start the domain, platform is the directory where the kernel to boot is, root.dev contains the name of the root device and vmnt is where the domain can be mounted using
But you don't want to do that now. You want to start up your domain, So this is how you do it
(this starts mydomU in 64bit mode)
$ xm console mydomU
(puts you on the console)
which starts the domU and puts you directly on the console - useful sometimes to find out why your domain isn't coming up
So at that point you on the console of your domain and it's coming up just as if its a fresh install of Solaris.
In future "Xen for Dummies" installments I'll show how to configure the network, add disks, create more cpus in the domU than you have in the real box! and I'm sure I can think of more later.
Technorati Tags: Solaris OpenSolaris Xen