Subject: Re: using port-xen
To: Hubert Feyrer <hubert@feyrer.de>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: port-xen
Date: 12/07/2004 14:57:23
On Tue, Dec 07, 2004 at 04:20:19PM +0100, Hubert Feyrer wrote:
> 
> There was an (IMHO) interesting discussion of using NetBSD/Xen to setup 
> housing machines for virtual servers etc., in response to someone asking
> for Jails on NetBSD.
> 
> See the "Jail For NetBSD" discussion on tech-kern, esp. here:
> http://mail-index.netbsd.org/tech-kern/2004/12/06/0008.html
> 
> BTW, it'd be nice if someone could write up some simple guide on how to 
> get Xen going on an existing i386 installation (what pkgs to install, 
> steps to take, etc.)

I don't have time to write a complete guide, but here is what I do have
time to tell you today:

To get Xen going on an existing i386 installation, you should do the
following:

1) Install all xen* packages from pkgsrc, and the python and grub
   packages.

2) Build an appropriate NetBSD/xen kernel.  NetBSD/xen differs from
   NetBSD/i386 *only in the kernel*.  *All user executables are those
   of NetBSD/i386*.  This kernel must include the DOM0OPS option so
   you can run it as domain 0.

3) Configure grub to boot xen, with your NetBSD/xen kernel as domain
   0.  Christian posted an example of this to this mailing list several
   months ago.  Also include a grub setting to boot your NetBSD/i386
   kernel.

4) Reboot.  You can now switch back and forth between NetBSD/i386 and
   NetBSD/xen just by changing your grub menu selection.  But if you
   have selected to boot Xen, you are now *already* running NetBSD/xen.

5) Now you must decide how you will provide storage space for your other
   Xen domains.  The simplest option is to use NFS and run them as
   "diskless" systems.  For this you can follow Christian's example.  In
   many cases this will be just as efficient as giving them dedicated disk
   partitions.  However, you can also dedicate disk partitions to your
   other Xen domains; if you want to do this, of course, you will need to
   have disk partitions available... you can give the Xen domain creation
   script command-line arguments to allocate partitions to particular VMs,
   to set the NFS root filesystem, etc. or modify the script very simply,
   since it is in Python and is quite clear.

6) One advanced topic to consider is whether you can run all your VMs
   with a shared, read-only disk device with most binaries, and a smaller
   read-write area per VM.  If you are building a new machine specifically
   to run Xen VMs you should probably think about this since there are
   disk-space, configuration-management, and security advantages to doing
   it this way.  Of course you can also do this over NFS, but with disk
   devices one major advantage is that Xen itself enforces the read-only
   nature of the shared block device and you need not worry about bugs in
   the NetBSD kernel.

7) Put an appropriate NetBSD/xen kernel (it does not need DOM0OPS) in
   each client filesystem and start the clients up.  You're done.  Note
   that you can move the client domains from one host to another just by
   moving their configuration file and filesystem image.  With some very
   minor changes to NetBSD it would even be possible to do this while they
   were running.

-- 
 Thor Lancelot Simon	                                      tls@rek.tjls.com
 	Am I politic?  Am I subtle?  Am I a Machiavel?
							-William Shakespeare