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.
15 export FSSIZE="$5" # in mebibytes
16 SWAPSIZE="$6" # in mebibytes
22 #LVSIZE=`lvs --noheadings --units m --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'`
25 IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1`
28 /sbin/lvcreate -L $(($FSSIZE+$SWAPSIZE))m -n "${NAME}_hda" $VGNAME
30 export TARGET=/dev/mapper/xenvg-"$(echo "${NAME}_hda" | sed -e 's/-/--/g')"
32 /usr/sbin/invirt-create-image
34 echo "disk = ['phy:$VGNAME/${NAME}_hda,hda,w']" >>/etc/xen/$HOSTNAME.cfg
35 echo "root = '/dev/hda1 ro'" >>/etc/xen/$HOSTNAME.cfg