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