root / trunk / shell / set-xen-config @ 34
Historique | Voir | Annoter | Télécharger (1,93 ko)
1 | 19 | storres | #! /bin/sh -x |
---|---|---|---|
2 | 19 | storres | # |
3 | 19 | storres | # ST 2012-03-09 |
4 | 19 | storres | # |
5 | 19 | storres | # Set the Xen configuration files |
6 | 19 | storres | # |
7 | 19 | storres | # Get the directory of the script. |
8 | 19 | storres | SCRIPT_PATH=`dirname $0` |
9 | 19 | storres | # Get the script name. |
10 | 19 | storres | SCRIPT_NAME=`basename $0` |
11 | 19 | storres | # Source the common configuration variables. |
12 | 19 | storres | . $SCRIPT_PATH/c-i-a-b.common |
13 | 19 | storres | # |
14 | 19 | storres | # File /etc/xen-tools/xen-tools.conf |
15 | 19 | storres | CURRENT_FILE=xen-tools.conf |
16 | 19 | storres | # Save the original files. |
17 | 19 | storres | CURRENT_DIR=/etc/xen-tools |
18 | 19 | storres | mv $CURRENT_DIR/$CURRENT_FILE $CURRENT_DIR/$CURRENT_FILE.orig.`date +%Y-%m-%d` |
19 | 19 | storres | # Set the new configuration file. |
20 | 19 | storres | cp $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_DIR/$CURRENT_FILE $CURRENT_DIR |
21 | 19 | storres | rpl __CLUSTER_ARCH__ $CLUSTER_ARCH $CURRENT_DIR/$CURRENT_FILE |
22 | 19 | storres | rpl __CLUSTER_IMAGE__ $CLUSTER_IMAGE $CURRENT_DIR/$CURRENT_FILE |
23 | 19 | storres | if [ "$CLUSTER_SWAP_SIZE" = "$CONST_NULL_DISK_SIZE" ]; then |
24 | 19 | storres | rpl __CLUSTER_NOSWAP__ "'$CLUSTER_NOSWAP'" $CURRENT_DIR/$CURRENT_FILE |
25 | 19 | storres | rpl __CLUSTER_SWAP_SIZE__ "'$CLUSTER_SWAP_SIZE'" $CURRENT_DIR/$CURRENT_FILE |
26 | 19 | storres | else |
27 | 19 | storres | rpl __CLUSTER_NOSWAP__ "'#$CLUSTER_NOSWAP'" $CURRENT_DIR/$CURRENT_FILE |
28 | 19 | storres | rpl __CLUSTER_SWAP_SIZE__ "'$CLUSTER_SWAP_SIZE'" $CURRENT_DIR/$CURRENT_FILE |
29 | 19 | storres | fi |
30 | 19 | storres | # |
31 | 19 | storres | # Script /etc/xen/scripts/network-bridge-internal. |
32 | 19 | storres | CURRENT_FILE=$CLUSTER_BRIDGE_SCRIPT |
33 | 19 | storres | # No orignal file to save |
34 | 19 | storres | CURRENT_DIR=/etc/xen/scripts |
35 | 19 | storres | # Set the file. |
36 | 19 | storres | cp $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_DIR/$CURRENT_FILE $CURRENT_DIR |
37 | 19 | storres | chmod u+x $CURRENT_DIR/$CURRENT_FILE |
38 | 19 | storres | # |
39 | 19 | storres | # File /etc/xen/xend-config.sxp |
40 | 19 | storres | CURRENT_FILE=xend-config.sxp |
41 | 19 | storres | # Save the original files. |
42 | 19 | storres | CURRENT_DIR=/etc/xen |
43 | 19 | storres | mv $CURRENT_DIR/$CURRENT_FILE $CURRENT_DIR/$CURRENT_FILE.orig.`date +%Y-%m-%d` |
44 | 19 | storres | # Set the new configuration file. |
45 | 19 | storres | cp $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_DIR/$CURRENT_FILE $CURRENT_DIR |
46 | 22 | storres | rpl __CLUSTER_BRIDGE_CLAUSE__ "$CLUSTER_BRIDGE_STANZA" \ |
47 | 19 | storres | $CURRENT_DIR/$CURRENT_FILE |
48 | 19 | storres | rpl __DOM0_CPUS_CLAUSE__ "$DOM0_CPUS_CLAUSE" $CURRENT_DIR/$CURRENT_FILE |
49 | 19 | storres | # |
50 | 19 | storres | # Restart Xend |
51 | 19 | storres | service xend restart |
52 | 19 | storres | # Pin the VPCU to the selected CPU for dom0 |
53 | 19 | storres | VCPU_NUM=0 |
54 | 19 | storres | for i in $DOM0_CPUS_LIST; do |
55 | 27 | storres | xm vcpu-pin $CONST_XEN_DOM0_NAME $VCPU_NUM $i |
56 | 19 | storres | VCPU_NUM=$((VCPU_NUM + 1)) |
57 | 19 | storres | done |