Last change
on this file since 2199 was
2161,
checked in by andersk, 16 years ago
|
Don't confuse {KB, MB, GB} with {KiB, MiB, GiB}.
|
File size:
896 bytes
|
Rev | Line | |
---|
[931] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # If this script is interrupted, it may not clean up after itself. |
---|
| 4 | # In particular, it may leave ${TARGET}1 mounted somewhere in tmp. |
---|
| 5 | # Unmount it, then kpartx -d $TARGET to clean up. |
---|
| 6 | |
---|
[938] | 7 | set -e |
---|
| 8 | |
---|
[931] | 9 | export PATH #WTF? |
---|
| 10 | |
---|
[938] | 11 | NAME="$1" |
---|
[931] | 12 | export HOSTNAME="$2" |
---|
| 13 | export DIST="$3" |
---|
| 14 | export MIRROR="$4" |
---|
[2161] | 15 | export FSSIZE="$5" # in mebibytes |
---|
| 16 | SWAPSIZE="$6" # in mebibytes |
---|
[938] | 17 | export IP="$7" |
---|
[931] | 18 | |
---|
| 19 | export ARCH=amd64 |
---|
[938] | 20 | VGNAME=xenvg |
---|
[931] | 21 | |
---|
[2161] | 22 | #LVSIZE=`lvs --noheadings --units m --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'` |
---|
[931] | 23 | |
---|
| 24 | if [ -z "$IP" ]; then |
---|
| 25 | IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1` |
---|
| 26 | fi |
---|
| 27 | |
---|
[2161] | 28 | /sbin/lvcreate -L $(($FSSIZE+$SWAPSIZE))m -n "${NAME}_hda" $VGNAME |
---|
[931] | 29 | |
---|
[938] | 30 | export TARGET=/dev/mapper/xenvg-"$(echo "${NAME}_hda" | sed -e 's/-/--/g')" |
---|
| 31 | |
---|
[1497] | 32 | /usr/sbin/invirt-create-image |
---|
[939] | 33 | |
---|
[940] | 34 | echo "disk = ['phy:$VGNAME/${NAME}_hda,hda,w']" >>/etc/xen/$HOSTNAME.cfg |
---|
[939] | 35 | echo "root = '/dev/hda1 ro'" >>/etc/xen/$HOSTNAME.cfg |
---|
Note: See
TracBrowser
for help on using the repository browser.