Xen-strap

From GridPP Wiki
Revision as of 09:46, 12 November 2008 by Marian klein (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


About

xen-strap is a tool, a bash script, which may help you to create an operating system disk image and set up the virtual xen guest system (domU). The tool was developed at Rutherford Appleton Laboratory (Science&Technology Facilities Council) by Marian Klein under the GPL licence. There are more tools around (xen-tools, rpmstrap, rinse ,debootstrap) with the same ambition, but none of them support Scientific Linux very well or/and are quite specific to a platform or type of target distribution. Nevertheless the author was inspired by those tools. Google for those other tools to get more info about them. If you don't know what the xen is, read this http://www.cl.cam.ac.uk/Research/SRG/netos/xen/

Please be aware that virt-install command may do the same or better job for you (although with longer argument list) see installation of paravirtuallized guests for virt-install (-p option) virt-install in SL5.2 is possible to use. Virt install in other distribution don't have to recognize Scientific linux.

After you read this site you may also read the non-wikified and longer and older site here http://www.gridpp.rl.ac.uk/pps/xen-strap/

Prerequisites

  • Your machine has to be running on the top of xen hypervisor (3.0.X was tested) with the xen-aware kernel. You must have fully functional dom0 [TODO: put the simpliest kickstart file which prepares the minimal xen dom0 environment] You don't need the xen system if you want to just prepare image and copy it on the xen system.
  • You have to have a root access to a xen machine, I really don't test the tool under non-root user even if it may make sense to do something for non-root users
  • You need to have the 'wget' package installed in dom0. (One unlikely exception is if you have access to an local mirror of a linux distribution you are interested in or if you have access to a nfs network disk with the mirror)
  • For creating the rpm-based images you need also rpm package in dom0. Nowadays usually not a problem even in the non-rpm based distributions.
  • For creating the deb-based domU images you need an archiver 'ar' (with older version of xen-strap) or 'tar' (with the latest version) in dom0 In distros like CentOS it is in package binutils. I bet you already have both of them unless, you have very minimalistic or stripped system installation.

Known issues and restrictions

Please be aware it has been just observed the tool does NOT WORK with selinux extension for some reasons. The problem is being investigated. In the meantime please disable selinux in /etc/selinux/config

#SELINUX=enforcing
SELINUX=permissive

and reboot your host xen (dom0) system.

Nice-to-have

  • You are recommended to have also the LVM disk system in dom0 , to generate easily block devices of any size on the fly.
  • bridge-utils, if you want to have a publicly accessible virtual machine and you don't want to hassle with the port forwarding and masqueradding then you need to set up the bridge in dom0 for domUs
  • host , it helps detect the ip when use specify the name of the machine and otherway around

Get the tool

No installation of the tool is necessary, just download one bash script and set execute flag for it :

wget http://www.gridpp.rl.ac.uk/pps/xen-strap/xen-strap
chmod 755 ./xen-strap

There is also an updated version with a patch provided by Riccardo Murri (SL4.7 support and --mac option support, rmurri@cscs.ch ), not tested by M. Klein.

wget http://www.gridpp.rl.ac.uk/pps/xen-strap/alt/xen-strap

Fully supported/tested distributions are:

CentOS 5.X , Scientific Linux 5.X  and Debian4.0/etch 

They are supported/tested for both uses as a dom0 and domU. FedoraCore 8 is tested only as a domU.

You get the list of all xen-strap supported distributions for target domU system with the command

xen-strap --supported-dists

Examples

No configuration at all is necessary!! The tool works even with zero config file. To get working the latest supported CentOS 4.X xen guest system (virtual domU) is as simple as that:

xen-strap --name=mybox1 --ip=dhcp -y -f -b centos4 file:/root/mybox1:2G:ext3

And you may get a cup of coffee while waiting for a login propmpt of the virtual machine.

You may want or need the the latest supported Scientific Linux 4.X instead. Use 'sl4' instead of 'centos4'

If you prefer lvm storage system and you want to build machine the virtual machine in LVM in the volume group xen (the group has to exist) and with the logical volume name mybox2 then you do:

xen-strap centos5 lvm:xen/mybox2

You may get more examples if you do this

xen-strap --examples

If you are stuck, read the lengthy help

 xen-strap --help

You also may specify a mirror which is a network-wise closer to you. You put the mirror as a third argument after the target storage or alternatively use the option --from= The alternative mirrors for the distributions you get from the command

xen-strap --show-mirrors  [distr]

where [distr] is name of the distribution as from output of the command

 xen-strap --supported-dists

You also may redefine the various built-in default parameters

xen-strap --get-vars > /etc/xen-strap/default

or

xen-strap --get-vars > /etc/xen-strap.cfg

and adjust the values either in /etc/xen-strap/default or in /etc/xen-strap.cfg

How does the tool work?

It varies depending on the type of the system you want to build.

  • For rpm-based target distributions (CentOS, ScientificLinux, FedoraCore, OpenSuse) it essentially downloads the packages from the mirrors of the chosen target distribution and installs them into a target image by executing of the command 'rpm'.
  • For deb based distributions (debian,ubuntu) it downloads the debootstrap utility from the web and uses it to make the disk image.
  • In both cases the xen-strap configures you images to have it prepared for the running under xen system.

This tool xen-strap was designed for some sort of compatibility with the former tools, it recognizes the options they have. You may use this tool exactly like debootstrap, rinse or debootstrap, so essentially the xen-strap replace them. The tool also partially replaces the xen-tools in that it does make complete xen domU image bootable in xen, providing there are some conditions met.

You may also read the non-wikified and longer and older site here http://www.gridpp.rl.ac.uk/pps/xen-strap/

Please send bug reports or suggestions to m.klein@rl.ac.uk

As of nov 2008 please send bug reports or suggestions to klein.marian@gmail.com or derek.ross@stfc.ac.uk

The tool might be unmaintaned. (look for virt-install)