root / trunk / shell / compute-node-model-create @ 58
Historique | Voir | Annoter | Télécharger (1,82 ko)
1 | 42 | storres | #! /bin/bash -x |
---|---|---|---|
2 | 42 | storres | # |
3 | 42 | storres | # ST - 2012-03-09 |
4 | 42 | storres | # |
5 | 42 | storres | # Create the front end, up to basic system installation. |
6 | 42 | storres | # |
7 | 42 | storres | # Get the directory of the script. |
8 | 42 | storres | SCRIPT_PATH=`dirname $0` |
9 | 42 | storres | # Get the script name. |
10 | 42 | storres | SCRIPT_NAME=`basename $0` |
11 | 42 | storres | # Source the common configuration variables. |
12 | 42 | storres | . $SCRIPT_PATH/c-i-a-b.common |
13 | 42 | storres | # |
14 | 42 | storres | # Check that the front-end virtual machine does not already exist. |
15 | 42 | storres | # |
16 | 42 | storres | CURRENT_HOST_NAME=$FRONT_END_HOST_NAME |
17 | 42 | storres | IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME` |
18 | 42 | storres | if [ -n "$IS_RUNNING" ] |
19 | 42 | storres | then |
20 | 42 | storres | echo |
21 | 42 | storres | echo The \"$CURRENT_HOST_NAME\" domU already exists. Aborting! |
22 | 42 | storres | echo |
23 | 42 | storres | exit 1 |
24 | 42 | storres | fi |
25 | 42 | storres | |
26 | 43 | storres | # Create the compute node model system disk. |
27 | 43 | storres | lvcreate -L$COMPUTE_NODE_MODEL_SYSTEM_DISK_SIZE \ |
28 | 43 | storres | -n $COMPUTE_NODE_MODEL_SYSTEM_DISK \ |
29 | 43 | storres | $COMPUTE_NODE_MODEL_SYSTEM_VOLUME_GROUP |
30 | 43 | storres | # Create a File System on the compute node model system disk. |
31 | 45 | storres | mkfs -t $COMPUTE_NODE_SYSTEM_DISK_FILE_SYSTEM \ |
32 | 43 | storres | $COMPUTE_NODE_MODEL_SYSTEM_VOLUME_GROUP_DEVICE/$COMPUTE_NODE_MODEL_SYSTEM_DISK |
33 | 43 | storres | # If necessary, create the swap volume for the compute node model. |
34 | 43 | storres | if [ $COMPUTE_NODE_MODEL_SWAP_DISK_SIZE != $CONST_NULL_DISK_SIZE ] ; then |
35 | 43 | storres | lvcreate -L $COMPUTE_NODE_MODEL_SWAP_DISK_SIZE \ |
36 | 43 | storres | -n $COMPUTE_NODE_MODEL_SWAP_DISK \ |
37 | 43 | storres | $COMPUTE_NODE_MODEL_SWAP_VOLUME_GROUP |
38 | 43 | storres | mkswap $COMPUTE_NODE_MODEL_SWAP_VOLUME_GROUP_DEVICE/$COMPUTE_NODE_MODEL_SWAP_DISK |
39 | 42 | storres | fi |
40 | 43 | storres | # No home disk: they are mounted from the front-end |
41 | 43 | storres | # |
42 | 42 | storres | # Mount the system disk to install the system. |
43 | 43 | storres | if [ ! -d $COMPUTE_NODE_MODEL_FILE_SYSTEM_MOUNT_POINT ]; then |
44 | 43 | storres | mkdir $COMPUTE_NODE_MODEL_FILE_SYSTEM_MOUNT_POINT |
45 | 42 | storres | fi |
46 | 43 | storres | mount $COMPUTE_NODE_MODEL_SYSTEM_VOLUME_GROUP_DEVICE/$COMPUTE_NODE_MODEL_SYSTEM_DISK \ |
47 | 43 | storres | $COMPUTE_NODE_MODEL_FILE_SYSTEM_MOUNT_POINT |
48 | 42 | storres | if [ $? -ne 0 ] ; then |
49 | 42 | storres | exit 1 |
50 | 42 | storres | fi |
51 | 42 | storres | # |
52 | 42 | storres | # Install the system. |
53 | 42 | storres | # |
54 | 42 | storres | debootstrap --arch $CONST_DEBIAN_ARCH $CONST_DEBIAN_VERSION \ |
55 | 43 | storres | $COMPUTE_NODE_MODEL_FILE_SYSTEM_MOUNT_POINT |
56 | 42 | storres | # |
57 | 42 | storres | exit 0 |