Subject: Re: rc.d script for starting Xen domains
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Johnny C. Lam <jlam@pkgsrc.org>
List: port-xen
Date: 10/03/2005 01:38:17
On Mon, Oct 03, 2005 at 12:13:23AM +0200, Manuel Bouyer wrote:
>
> Do you have an idea on how to deal with file-backed domains ?
> On my production systems I use vnd attached to files for guest domains,
> and I've not found a nice scheme to deal with this yet.

I use a block-file script that's much like the one that was recently
committed to the sysutils/xentools20 package.  With that script in
place, you can use the following in the domain config file to
automatically configure the vnd device to attach to the specified
file:

	disk = [ 'file:/path/to/disk.img,wd0d,w' ]

My script has some trivial differences that lets you specify an optional
argument to name exactly which vnd device you want to create, e.g.

	disk = [ 'file:/path/to/disk.img:vnd2,wd0d,w' ]

Using the block-file script lets the xend daemon configure the vnd
devices when creating the domain as well as unconfiguring them when
shutting down the domain.  In this way, there's no difference in
configuration between domains that are file-backed and domains that
are device-backed, other than in the "disk" specification, and I can
start and stop all of the guest domains in the same way.

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>