#!/bin/sh
#Create a VM:
# allocate logical volumes for root and swap filesystems
# make swap and root filesystems
# untar VM image
# call editor to edit network configuration files
# copy and edit xen template
# create VM
#
#Parameters:
# $1 - Size for root filesystem
# $2 - Name of VM
#
#Author: Andrey Kharuk, 01/06/2007
#
if [ -z "$1" ]; then
echo " " >&2
echo "Usage: `basename $0` disksize(in Mb) VMname" >&2; exit 2
echo " " >&2
echo " " >&2
fi
lvcreate -L $1M -n $2R VolumeGroup00 ;
lvcreate -L 512M -n $2S VolumeGroup00 ;
mkswap /dev/VolumeGroup00/$2S ;
mkfs -t ext3 /dev/VolumeGroup00/$2R ;
mkdir /srv/$2 ;
mount -t ext3 /dev/VolumeGroup00/$2R /srv/$2 ;
cd /srv/$2 ;
tar xjpf /etc/xen/vm-image-0.0.1.tar.bz2 ;
nano /srv/$2/etc/sysconfig/network ;
nano /srv/$2/etc/sysconfig/network-scripts/ifcfg-eth0 ;
cp /etc/xen/template /etc/xen/$2 ;
nano /etc/xen/$2 ;
cd ..
umount /srv/$2 ;
xm create -c $2
Tar-ball 'vm-image-0.0.1.tar.bz2' is an image of fresh installed CentOS 4.0 on VM.
Both files reside in gateway.bestgrid.org:/etc/xen
No comments:
Post a Comment