root / trunk / shell / compute-node-model-start @ 46
Historique | Voir | Annoter | Télécharger (897 octet)
1 | 42 | storres | #! /bin/bash -x |
---|---|---|---|
2 | 42 | storres | # |
3 | 45 | storres | # ST - 2012-07-03 |
4 | 42 | storres | # |
5 | 45 | storres | # Start the compute node model. |
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 | 45 | storres | CURRENT_HOST_NAME=$COMPUTE_NODE_MODEL_HOST_NAME |
15 | 42 | storres | # |
16 | 45 | storres | CPUS_LIST=$COMPUTE_NODE_MODEL_CPUS_LIST |
17 | 42 | storres | CPUS="" |
18 | 42 | storres | for i in $CPUS_LIST |
19 | 42 | storres | do |
20 | 42 | storres | if [ "x$CPUS" == "x" ] |
21 | 42 | storres | then |
22 | 42 | storres | CPUS=$i |
23 | 42 | storres | else |
24 | 42 | storres | CPUS="$CPUS,$i" |
25 | 42 | storres | fi |
26 | 42 | storres | done |
27 | 42 | storres | # |
28 | 42 | storres | # Start the virtual machine |
29 | 42 | storres | # |
30 | 42 | storres | xm create $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg |
31 | 42 | storres | # |
32 | 42 | storres | # Wait until the virtual machine has started |
33 | 42 | storres | # |
34 | 42 | storres | IS_RUNNING="" |
35 | 42 | storres | while [ -z "$IS_RUNNING" ] |
36 | 42 | storres | do |
37 | 42 | storres | IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME` |
38 | 42 | storres | sleep 1 |
39 | 42 | storres | done |
40 | 42 | storres | # |
41 | 42 | storres | # Pin the VCPUs to "real" CPUs. |
42 | 42 | storres | # |
43 | 42 | storres | VCPU_NUM=0 |
44 | 42 | storres | for i in $CPUS_LIST |
45 | 42 | storres | do |
46 | 42 | storres | xm vcpu-pin $CURRENT_HOST_NAME $VCPU_NUM $i |
47 | 42 | storres | VCPU_NUM=$((VCPU_NUM + 1)) |
48 | 42 | storres | done |
49 | 42 | storres | # |
50 | 42 | storres | exit 0 |