What I've been doing. Breakdown

Friday May 02, 2008

One of my tasks at the moment is to run tests on Solaris Nevada, running as a domu on a Linux dom0.

What follows is a howto for installing hvm(Hardware Virtual Machine) guests on Ubuntu Linux, 8.04 (Hardy Heron) server-64.

Now in my case this is a build of Solaris Nevada(please see here for more information on OpenSolaris), and throughout this howto I will refer to it as snv, please feel free to switch this with your own OS name (or whatever you like really).

The machine I'm using is a Sun Fire X4150 (one of the servers on which 8.10 is certified), this machine has 8 cores (2x Quadcore Xeon x64 processors), which have Intels virtualisation extensions(Intel VT). And with plenty of RAM and 4 hard drives this machine is great for running many guests.

To be able to Xen for full virtualisation (hvm) you need a processor that has the needed extensions. Either AMD-V or Intel VT, if you don't have a chip with these extensions you might take a look at using virtualbox.

Dom0 setup

During install manually assign network info for primary network card and dns servers so as to resolve the package repositories.

Install Xen (version 3.2)
sudo apt-get install ubuntu-xen-server
sudo reboot

You should now have booted the kernel with Xen extensions.

uname -a should return
Linux hostname 2.6.24-16-xen #1 SMP Thu Apr 10 14:35:03 UTC 2008 x86_64 GNU/Linux

ps -A|grep xen should return
46 ? 00:00:00 xenwatch
47 ? 00:00:00 xenbus
5264 ? 00:00:00 xenstored
5272 ? 00:00:00 xenconsoled

xm list should return
Name ID Mem VCPUs State Time(s)
Domain-0 0 7933 8 r----- 24.0

Great, were all set to get started.

vi /etc/modules
change loop to
[...]
loop max_loop=64
[...]

####### Not exactly needed ########
One of the handy tools available on Solaris is mkfile, which you can use to create a file of whichever size. The closest Linux has to this is dd, which is a bit more ugly. However if you want to keep using dd, then by all means do.

So below is a simple zsh script which give you a nicer interface for creating files of specific sizes.
apt-get install zsh

save to /usr/bin/mkfile
#!/usr/bin/zsh
echo "mkfile [new_file_name] [filesize in Mb]"
dd if=/dev/zero of=$1 oflag=direct bs=1M count=$2

sudo chmod +x /usr/bin/mkfile

###################################
Create a hard drive for our Xen guest using mkfile (use dd if you prefer).
mkfile /mnt/sdb/snv.img 8000

*/mnt/sdb is the mount point of one of my systems drives, I intend to have one drive for each guest, thereby not killing performance by over using one disc.

We'll be using VNC to connect to get a screen from our guests so we install xvnc.
sudo apt-get install xvnc4viewer

Our plan is to install directly from an iso file, however there is currently a bug in Xen on 8.04 (or is it in 8.04, I don't know), which prevent us from doing that (the normal way) or even using our newly created .img file.

https://bugs.launchpad.net/ubuntu/+source/xen-3.2/+bug/211726
https://bugs.launchpad.net/ubuntu/+source/xen-3.2/+bug/211728

However below is the(a) workaround.

We mount our iso file to a loopback device (/dev/loop)
losetup /dev/loop0 /export/xen/isos/snv.i386.iso

And the same again for our .img file
losetup /dev/loop1 /mnt/sdb/snv.img

Now we create our guest(domu) configuration file, this is what Xen will use when the guest is created.
add below to /etc/xen/snv

kernel = "/usr/lib/xen/boot/hvmloader"
builder = 'hvm'
memory = 1024
name = "snv"
vcpus = 1
vif = [ 'type=ioemu, bridge=xenbr0' ]
disk = [ 'phy:/dev/loop1,ioemu:hda,w','phy:/dev/loop0,hdc:cdrom,r' ]
device_model = '/usr/lib/xen/bin/qemu-dm'
cdrom='/dev/hda'
ne2000=0
sdl=0
vnc=1
boot='d'

We then use xm to create our newly configured DomU

xm create snv

We now want to connect to our newly created guest and finish the install process, we do this with vnc.
vncviewer localhost

If your lucky, and have had no errors up to this point a window with the install screen should pop up.
Once you've finished the install you'll want your guest to boot off the .img file with the newly installed OS instead of the install cd/iso.

First shutdown your guest
xm shutdown snv

Edit your /etc/xen/snv file
change boot='d' boot='c' (were telling Xen to boot from drive c, instead of drive d)

Now start up your domu
xm create snv

Reconnect to your guest with vncviewer, and you should, if your lucky, be booting into your guest OS.

This is full virtualisation, as far as the OS your install is concerned, it's being installed on a real PC.

Comments:

Have you checked network between SNV DomU and Ubuntu HH Dom0 ?
What was Nevada Build you tested ?

Posted by Boris Derzhavets on May 17, 2008 at 08:34 AM IST #

Sorry, two more questions:-
1.I would expect cdrom='/dev/hdc'
It looks like something special for SNV HVM profile.
WinXP HVM profile doesn't need it for example.
2 What means ne2000=0 ?

Posted by Boris Derzhavets on May 17, 2008 at 11:03 AM IST #

ne2000=0 means we're disabling the ne2000 NIC which is the default, Solaris doesn't have the drivers (I was told... or did I read it?).

As for the network between DomU SNV & Ubuntu HH it works fine, dhcp, NIS, and NFS seem to work out of the box with the above profiles. The versions of SNV (as DomU) that I have tested are snv_89 & snv_90. And when I say tested I mean installed & booted & could connect remotely. I still haven't gotten around to running some actuall tests yet.

Posted by James McCarthy on May 19, 2008 at 08:54 AM IST #

Please, view:-
http://www.opensolaris.org/jive/thread.jspa?threadID=60661&tstart=0
SNV87,85,81,79b HVM DomUs have been tested at Ubuntu 8.04 Desktop Dom0 (amd64).
87 - failure at install immediately.
85 - failure at boot up (installer ran OK)
81,79b - OK
Profiles like yours , except no "cdrom" entry used.
Seemed to be unimportant. Any comments,if possible.
Thank you.

Posted by Boris Derzhavets on May 19, 2008 at 12:40 PM IST #

A couple links that you or others might find useful:

http://howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories
http://deshantm.livejournal.com/29959.html

Posted by Todd Deshane on May 20, 2008 at 12:53 AM IST #

Is "xm shutdown" working properly for your HVM DomU? Is it doing a proper shutdown or does it just kill the DomU?

Posted by Daniel Asplund on June 02, 2008 at 08:49 AM IST #

xm shutdown support is added by the Windows PV drivers, for the GPL version of them see:
http://wiki.xensource.com/xenwiki/XenWindowsGplPv

Posted by Todd Deshane on June 14, 2008 at 04:41 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed