| 
                Last change
                  on this file since 642 was
                  642,
                  checked in by broder, 17 years ago
           | 
        
        
          | 
               
Hyphens in the LV name are replaced with double hyphens in /dev/mapper 
 
           | 
        
        | 
            File size:
            1.2 KB
           | 
      
      
        
  | Rev | Line |   | 
|---|
| [635] | 1 | #!/bin/sh | 
|---|
 | 2 |  | 
|---|
 | 3 | export PATH #WTF? | 
|---|
 | 4 |  | 
|---|
 | 5 | HOSTNAME="$2" | 
|---|
 | 6 | DIST="$3" | 
|---|
 | 7 | MIRROR="$4" | 
|---|
 | 8 | IMAGESIZE="$5" | 
|---|
 | 9 | IP="$6" | 
|---|
 | 10 |  | 
|---|
 | 11 | ARCH=amd64 | 
|---|
 | 12 |  | 
|---|
 | 13 | #LVSIZE=`lvs --noheadings --units M --nosuffix -o Size /dev/xenvg/d_foobar_hda | sed 's/\..*//'` | 
|---|
 | 14 |  | 
|---|
 | 15 | if [ -z "$IP" ]; then | 
|---|
 | 16 |     IP=`host $HOSTNAME.xvm.mit.edu | sed 's/.* //' | head -n 1` | 
|---|
 | 17 | fi | 
|---|
 | 18 |  | 
|---|
| [642] | 19 | VOLUME=/dev/mapper/xenvg-d_$(echo "$HOSTNAME" | sed -e 's/-/--/g')_hda | 
|---|
| [635] | 20 |  | 
|---|
 | 21 | # If this script is interrupted, it may not clean up after itself. | 
|---|
 | 22 | # In particular, it may leave ${VOLUME}1 mounted somewhere in tmp. | 
|---|
 | 23 | # Unmount it, then kpartx -d $VOLUME to clean up. | 
|---|
 | 24 |  | 
|---|
 | 25 | ### | 
|---|
 | 26 | ###  Create the device for SIPB-Xen purposes | 
|---|
 | 27 | ### | 
|---|
 | 28 | echo ,${IMAGESIZE}$',L,*\n,,S\n;\n;' | sfdisk -uM -H 255 -S 63 $VOLUME | 
|---|
 | 29 | kpartx -a $VOLUME | 
|---|
 | 30 |  | 
|---|
 | 31 | # We use static IP addresses since dhcp doesn't work in paravm because | 
|---|
 | 32 | # of a UDP checksum bug. | 
|---|
 | 33 |  | 
|---|
 | 34 | xen-create-image --image-dev ${VOLUME}1 --swap-dev ${VOLUME}2 --fs ext3 --ide --arch $ARCH --dist $DIST --hostname $HOSTNAME --mirror $MIRROR --ip=$IP --netmask=255.255.0.0 --gateway=18.181.0.1 --template=/dev/null --cache | 
|---|
 | 35 |  | 
|---|
 | 36 | # xen-create-image always creates a config file.  The | 
|---|
 | 37 | # --template=/dev/null argument makes it empty, but it still should be | 
|---|
 | 38 | # removed. | 
|---|
 | 39 | rm -f /etc/xen/$HOSTNAME.cfg | 
|---|
 | 40 |  | 
|---|
 | 41 | kpartx -d $VOLUME | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.