Index: trunk/shell/finish-up-front-end
===================================================================
--- trunk/shell/finish-up-front-end	(revision 36)
+++ trunk/shell/finish-up-front-end	(revision 37)
@@ -1,259 +0,0 @@
-#! /bin/bash -x
-#
-# ST - 2012-05-25
-#
-# Finish up the front end installation.
-#
-# Get the directory of the script.
-SCRIPT_PATH=`dirname $0`
-# Get the script name.
-SCRIPT_NAME=`basename $0`
-# Source the common configuration variables.
-. $SCRIPT_PATH/c-i-a-b.common
-
-CURRENT_HOST_NAME=$FRONT_END_HOST_NAME
-#
-# Get the cluster MAC address
-#
-FRONT_END_CLUSTER_MAC_ADDRESS=\
-`awk -F, -v INDEX=$CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX '{if (FNR==INDEX) {print $1}}' $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_PATH/$CONST_DHCP_HOSTS_FILE_BASENAME`
-#
-#
-# Create the Xen configuration file from a template
-#
-CURRENT_PATH=/etc/xen
-cp templates$CURRENT_PATH/$CONST_FRONT_END_XEN_TEMPLATE_NAME \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-rpl Template Configuration $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-rpl __FRONT_END_KERNEL__ $COMPUTE_NODE_KERNEL \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-rpl __FRONT_END_RAMDISK__ $FRONT_END_RAMDISK \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-rpl __FRONT_END_VCPUS_NUM__ $FRONT_END_VCPUS_NUM \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-CPUS_LIST=$FRONT_END_CPUS_LIST
-CPUS=""
-for i in $CPUS_LIST
-  do
-    if [ "x$CPUS" == "x" ]
-      then
-        CPUS=$i
-      else
-        CPUS="$CPUS,$i"
-    fi
-done
-rpl __FRONT_END_CPUS__ $CPUS \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Memory
-rpl __FRONT_END_MEMORY__ $FRONT_END_MEMORY \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Root device
-rpl __XEN_SYSTEM_DISK_ROOT_DEVICE_STANZA__ "$CONST_XEN_SYSTEM_DISK_ROOT_DEVICE_STANZA" \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-#
-# System disk stuff
-FRONT_END_SYSTEM_DISK_STANZA="'phy:${FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE}/${FRONT_END_SYSTEM_DISK},$FRONT_END_SYSTEM_VIRTUAL_VOLUME,w'"
-rpl __FRONT_END_SYSTEM_DISK_STANZA__ "$FRONT_END_SYSTEM_DISK_STANZA" \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Home disk stuff
-FRONT_END_HOME_DISK_STANZA="'phy:${FRONT_END_HOME_VOLUME_GROUP_DEVICE}/${FRONT_END_HOME_DISK},$FRONT_END_HOME_VIRTUAL_VOLUME,w'"
-rpl __FRONT_END_HOME_DISK_STANZA__ "$FRONT_END_HOME_DISK_STANZA" \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Swap disk stuff.
-if [ "x$FRONT_END_SWAP_DISK_SIZE" != "x$CONST_NULL_DISK_SIZE" ] ; then
-  FRONT_END_SWAP_DISK_STANZA="'phy:${FRONT_END_SWAP_VOLUME_GROUP_DEVICE}/${FRONT_END_SWAP_DISK},$FRONT_END_SWAP_VIRTUAL_VOLUME,w'"
-  rpl __FRONT_END_SWAP_DISK_STANZA__ $FRONT_END_SWAP_DISK_STANZA \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-  # Comment out the noswap stanza.
-  rpl __FRONT_END_NOSWAP__ "#$CLUSTER_NOSWAP" \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-else
-  echo y | rpl -f __FRONT_END_SWAP_DISK_STANZA__ "" \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-  rpl __FRONT_END_NOSWAP__ $CLUSTER_NOSWAP \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-fi
-#
-rpl __FRONT_END_HOST_NAME__ $CURRENT_HOST_NAME \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Vif stuff.
-VIF_STANZA=$CONST_XEN_VIF_STANZA_PREFIX
-EXTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_EXTERNAL_MAC_ADDRESS}"
-INTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_CLUSTER_MAC_ADDRESS}"
-INTERNAL_BRIDGE="${CONST_XEN_BRIDGE_PREFIX}${CLUSTER_BRIDGE_NAME}"
-INTERNAL_IP="${CONST_XEN_IP_PREFIX}${FRONT_END_CLUSTER_STATIC_IP}"
-if [ $CLUSTER_EXTERNAL_ADDRESSES_BY_DHCP -eq 1 ] ;then
-  rpl __XEN_DHCP_STANZA__ "$CONST_XEN_DHCP_STANZA" \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-  VIF_STANZA=${VIF_STANZA}${EXTERNAL_MAC}"','"${INTERNAL_IP}","${INTERNAL_MAC}","${INTERNAL_BRIDGE}${CONST_XEN_VIF_STANZA_POSTFIX}
-else
-  # Comment out the DHCP_STANZA.
-  rpl __XEN_DHCP_STANZA__ "#$CONST_XEN_DHCP_STANZA" \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-  VIF_STANZA=${VIF_STANZA}${EXTERNAL_IP}","${EXTERNAL_MAC}",'"${INTERNAL_IP}","${INTERNAL_MAC},${INTERNAL_BRIDGE}${CONST_XEN_VIF_STANZA_POSTFIX}
-fi
-# In any case, write the VIF_STANZA
-rpl __VIF_STANZA__ "$VIF_STANZA" \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# Console stuff as extra parameter
-rpl __EXTRA_STANZA__ "$CONST_XEN_EXTRA_STANZA" \
-     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-# End creation of Xen configuration file.
-#
-# Complet installation
-#
-# Modules stuff.
-#
-#  Create the directory on the new image, if it does not exit yet.
-if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules ] ; then
-  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules
-fi
-#
-#  Copy the modules
-#
-XEN_MODULES_DIRECTORY=`ls /lib/modules | grep xen `
-for i in $XEN_MODULES_DIRECTORY ; do
-  cp -a /lib/modules/$i $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules
-done
-#
-# Module stuff done.
-#
-# Generate or configure the specific files from templates
-#
-# Create the /etc directory, if necessary
-if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc ] ; then
-  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc
-fi
-# Copy the sources list
-if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt ] ; then
-  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt
-fi
-cp /etc/apt/sources.list $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt
-
-# /etc/network/interfaces
-# The first interface is DHCP configured.
-# No '/' between $FRONT_END_FILE_SYSTEM_MOUNT_POINT and $CURRENT_PATH
-CURRENT_PATH=/etc/network
-if [ ! -d ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH} ] ; then
-  mkdir ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}
-fi
-cp templates$CURRENT_PATH/$FRONT_END_INTERFACES_TEMPLATE \
-   $FRONT_END_FILE_SYSTEM_MOUNT_POINT$CURRENT_PATH/interfaces
-if [ $CLUSTER_EXTERNAL_ADDRESSES_BY_DHCP -eq 1 ] ; then
-  ETH0_STANZA="iface eth0 inet dhcp"
-  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_ADDRESS__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_NETMASK__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_NETWORK__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_GATEWAY__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_BROADCAST__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_NAMESERVERS__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ "" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-else
-  ETH0_STANZA="iface eth0 inet static"
-  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_ADDRESS__ "$FRONT_END_CLUSTER_STATIC_IP" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_NETMASK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETMASK" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_NETWORK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETWORK" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-  echo y | rpl __ETH0_STATIC_GATEWAY__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_GATEWAY" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_BROADCAST__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_BROADCAST" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_NAMESERVERS__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_NAMESERVERS" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
-  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_SEARCH" \
-      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-fi 
-# Static address on the cluster interface.
-ADDRESS="${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX}"
-rpl __ETH1_STATIC_ADDRESS__ $ADDRESS  \
-    ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-rpl __ETH1_STATIC_NETMASK__ $CLUSTER_STATIC_NETMASK  \
-    ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
-    
-# /etc/hostname
-CURRENT_PATH=/etc
-echo $CURRENT_HOST_NAME > "${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/hostname"
-# /etc/hosts. Script generated.
-CURRENT_PATH=/etc
-$SCRIPT_PATH/generate-hosts-file \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/hosts
-# /etc/resolv.conf
-CURRENT_PATH=/etc
-cp $TEMPLATES_DIR$CURRENT_PATH/resolv.conf \
-   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
-rpl __CLUSTER_DOMAIN_NAME__ "${CLUSTER_DOMAIN_NAME}." \
-   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
-rpl __FRONT_END_STATIC_ADDRESS__ "${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX}" \
-   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
-#
-# /etc/fstab
-#
-CURRENT_PATH=/etc
-cp ${TEMPLATES_DIR}${CURRENT_PATH}/${FRONT_END_FSTAB_TEMPLATE} \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
-  # Front-End System Disk Line
-FESDL=${FRONT_END_SYSTEM_VIRTUAL_VOLUME_DEVICE}
-FESDL="$FESDL	/		$FRONT_END_SYSTEM_DISK_FILE_SYSTEM	errors=remount-ro	0	1"
-rpl __FRONT_END_SYSTEM_DISK_LINE__ "$FESDL" \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
-  # Font-End Home Disk Line
-FEHDL=${FRONT_END_HOME_VIRTUAL_VOLUME_DEVICE}
-FEHDL="$FEHDL	/home		$FRONT_END_HOME_DISK_FILE_SYSTEM	errors=remount-ro	0	2"
-rpl __FRONT_END_HOME_DISK_LINE__ "$FEHDL" \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
-  # Font-End Swap Disk Line
-if [ "x$FRONT_END_SWAP_DISK_SIZE" != "x$CONST_NULL_DISK_SIZE" ] ; then
-  FESDL=${FRONT_END_SWAP_VIRTUAL_VOLUME_DEVICE}
-  FESDL="$FESDL	none		swap				0	0"
-else
-  FESDL=""
-fi
-# "rpl -f" since $FESDL can be an empty string.
-rpl -f __FRONT_END_SWAP_DISK_LINE__ "$FESDL" \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
-#
-# Umount the compute node system disk
-#
-# Order matters since the /home file system is mounted on the
-# on the system partition
-umount $FRONT_END_FILE_SYSTEM_MOUNT_POINT/home
-umount $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-#
-# Start the virtual machine
-#
-xm create $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-#
-exit 0
-#
-# Wait until the virtual machine has started
-#
-IS_RUNNING=""
-while [ -z "$IS_RUNNING" ]
-  do
-    IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME`
-    sleep 1
-done
-#
-# Pin the VCPUs to "real" CPUs.
-#
-VCPU_NUM=0
-for i in $CPUS_LIST
-  do
-    xm vcpu-pin $CURRENT_HOST_NAME $VCPU_NUM $i
-    VCPU_NUM=$((VCPU_NUM + 1))
-done
-
-exit 0
Index: trunk/shell/create-front-end
===================================================================
--- trunk/shell/create-front-end	(revision 36)
+++ trunk/shell/create-front-end	(revision 37)
@@ -1,78 +0,0 @@
-#! /bin/bash -x
-#
-# ST - 2012-03-09
-#
-# Create and start the front end.
-#
-# Get the directory of the script.
-SCRIPT_PATH=`dirname $0`
-# Get the script name.
-SCRIPT_NAME=`basename $0`
-# Source the common configuration variables.
-. $SCRIPT_PATH/c-i-a-b.common
-#
-# Check that the front-end virtual machine does not already exist.
-#
-CURRENT_HOST_NAME=$FRONT_END_HOST_NAME
-IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME`
-if [ -n "$IS_RUNNING" ]
-  then
-    echo
-    echo The \"$CURRENT_HOST_NAME\" domU already exists. Aborting!
-    echo
-    exit 1
-fi
-
-# Create the front-end system disk.
-lvcreate -L$FRONT_END_SYSTEM_DISK_SIZE \
-         -n  $FRONT_END_SYSTEM_DISK \
-         $FRONT_END_SYSTEM_VOLUME_GROUP
-# Create a File System on the front-end system disk.
-mkfs -t $FRONT_END_SYSTEM_DISK_FILE_SYSTEM \
-        $FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE/$FRONT_END_SYSTEM_DISK
-# If necessary, create the swap volume for the front end.
-if [ $FRONT_END_SWAP_DISK_SIZE != $CONST_NULL_DISK_SIZE ] ; then
-  lvcreate -L $FRONT_END_SWAP_DISK_SIZE \
-           -n $FRONT_END_SWAP_DISK \
-           $FRONT_END_SWAP_VOLUME_GROUP
-  mkswap $FRONT_END_SWAP_VOLUME_GROUP_DEVICE/$FRONT_END_SWAP_DISK
-fi
-# Create the VM home disk.
-lvcreate -L$FRONT_END_HOME_DISK_SIZE \
-         -n  $FRONT_END_HOME_DISK \
-         $FRONT_END_HOME_VOLUME_GROUP
-# Create a File System on the front-end system disk.
-mkfs -t $FRONT_END_HOME_DISK_FILE_SYSTEM \
-        $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK
-# Mount the system disk to install the system.
-if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT ]; then
-  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-fi
-mount $FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE/$FRONT_END_SYSTEM_DISK \
-      $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-if [ $? -ne 0 ] ; then
-  exit 1
-fi 
-# Create the directory for the homes
-if [ ! -d "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home" ]; then
-  mkdir "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home"
-fi
-mount $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK \
-      "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home"
-
-#
-# Get the cluster MAC address
-#
-CURRENT_PATH=/etc
-FRONT_END_CLUSTER_MAC_ADDRESS=\
-`awk -F, -v INDEX=$CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX '{if (FNR==INDEX) {print $1}}' $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_PATH/$CONST_DHCP_HOSTS_FILE_BASENAME`
-#
-# Install the system.
-# 
-debootstrap --arch $CONST_DEBIAN_ARCH $CONST_DEBIAN_VERSION \
-    $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-# exit 0
-#
-# Complete the installation
-#
-exit 0
Index: trunk/shell/front-end-start
===================================================================
--- trunk/shell/front-end-start	(revision 0)
+++ trunk/shell/front-end-start	(revision 37)
@@ -0,0 +1,50 @@
+#! /bin/bash -x
+#
+# ST - 2012-05-25
+#
+# Start the front end.
+#
+# Get the directory of the script.
+SCRIPT_PATH=`dirname $0`
+# Get the script name.
+SCRIPT_NAME=`basename $0`
+# Source the common configuration variables.
+. $SCRIPT_PATH/c-i-a-b.common
+#
+CURRENT_HOST_NAME=$FRONT_END_HOST_NAME
+#
+CPUS_LIST=$FRONT_END_CPUS_LIST
+CPUS=""
+for i in $CPUS_LIST
+  do
+    if [ "x$CPUS" == "x" ]
+      then
+        CPUS=$i
+      else
+        CPUS="$CPUS,$i"
+    fi
+done
+#
+# Start the virtual machine
+#
+xm create $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+#
+# Wait until the virtual machine has started
+#
+IS_RUNNING=""
+while [ -z "$IS_RUNNING" ]
+  do
+    IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME`
+    sleep 1
+done
+#
+# Pin the VCPUs to "real" CPUs.
+#
+VCPU_NUM=0
+for i in $CPUS_LIST
+  do
+    xm vcpu-pin $CURRENT_HOST_NAME $VCPU_NUM $i
+    VCPU_NUM=$((VCPU_NUM + 1))
+done
+#
+exit 0

Property changes on: trunk/shell/front-end-start
___________________________________________________________________
Added: svn:executable
   + *

Index: trunk/shell/front-end-finish-up
===================================================================
--- trunk/shell/front-end-finish-up	(revision 0)
+++ trunk/shell/front-end-finish-up	(revision 37)
@@ -0,0 +1,266 @@
+#! /bin/bash -x
+#
+# ST - 2012-05-25
+#
+# Finish up the front end installation.
+#
+# Get the directory of the script.
+SCRIPT_PATH=`dirname $0`
+# Get the script name.
+SCRIPT_NAME=`basename $0`
+# Source the common configuration variables.
+. $SCRIPT_PATH/c-i-a-b.common
+
+CURRENT_HOST_NAME=$FRONT_END_HOST_NAME
+#
+# Get the cluster MAC address
+#
+FRONT_END_CLUSTER_MAC_ADDRESS=\
+`awk -F, -v INDEX=$CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX '{if (FNR==INDEX) {print $1}}' $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_PATH/$CONST_DHCP_HOSTS_FILE_BASENAME`
+#
+#
+# Create the Xen configuration file from a template
+#
+CURRENT_PATH=/etc/xen
+cp templates$CURRENT_PATH/$CONST_FRONT_END_XEN_TEMPLATE_NAME \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+rpl Template Configuration $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+rpl __FRONT_END_KERNEL__ $COMPUTE_NODE_KERNEL \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+rpl __FRONT_END_RAMDISK__ $FRONT_END_RAMDISK \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+rpl __FRONT_END_VCPUS_NUM__ $FRONT_END_VCPUS_NUM \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+CPUS_LIST=$FRONT_END_CPUS_LIST
+CPUS=""
+for i in $CPUS_LIST
+  do
+    if [ "x$CPUS" == "x" ]
+      then
+        CPUS=$i
+      else
+        CPUS="$CPUS,$i"
+    fi
+done
+rpl __FRONT_END_CPUS__ $CPUS \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Memory
+rpl __FRONT_END_MEMORY__ $FRONT_END_MEMORY \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Root device
+rpl __XEN_SYSTEM_DISK_ROOT_DEVICE_STANZA__ "$CONST_XEN_SYSTEM_DISK_ROOT_DEVICE_STANZA" \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+#
+# System disk stuff
+FRONT_END_SYSTEM_DISK_STANZA="'phy:${FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE}/${FRONT_END_SYSTEM_DISK},$FRONT_END_SYSTEM_VIRTUAL_VOLUME,w'"
+rpl __FRONT_END_SYSTEM_DISK_STANZA__ "$FRONT_END_SYSTEM_DISK_STANZA" \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Home disk stuff
+FRONT_END_HOME_DISK_STANZA="'phy:${FRONT_END_HOME_VOLUME_GROUP_DEVICE}/${FRONT_END_HOME_DISK},$FRONT_END_HOME_VIRTUAL_VOLUME,w'"
+rpl __FRONT_END_HOME_DISK_STANZA__ "$FRONT_END_HOME_DISK_STANZA" \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Swap disk stuff.
+if [ "x$FRONT_END_SWAP_DISK_SIZE" != "x$CONST_NULL_DISK_SIZE" ] ; then
+  FRONT_END_SWAP_DISK_STANZA="'phy:${FRONT_END_SWAP_VOLUME_GROUP_DEVICE}/${FRONT_END_SWAP_DISK},$FRONT_END_SWAP_VIRTUAL_VOLUME,w'"
+  rpl __FRONT_END_SWAP_DISK_STANZA__ $FRONT_END_SWAP_DISK_STANZA \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+  # Comment out the noswap stanza.
+  rpl __FRONT_END_NOSWAP__ "#$CLUSTER_NOSWAP" \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+else
+  echo y | rpl -f __FRONT_END_SWAP_DISK_STANZA__ "" \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+  rpl __FRONT_END_NOSWAP__ $CLUSTER_NOSWAP \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+fi
+#
+rpl __FRONT_END_HOST_NAME__ $CURRENT_HOST_NAME \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Vif stuff.
+VIF_STANZA=$CONST_XEN_VIF_STANZA_PREFIX
+EXTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_EXTERNAL_MAC_ADDRESS}"
+INTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_CLUSTER_MAC_ADDRESS}"
+INTERNAL_BRIDGE="${CONST_XEN_BRIDGE_PREFIX}${CLUSTER_BRIDGE_NAME}"
+INTERNAL_IP="${CONST_XEN_IP_PREFIX}${FRONT_END_CLUSTER_STATIC_IP}"
+if [ $CLUSTER_EXTERNAL_ADDRESSES_BY_DHCP -eq 1 ] ;then
+  rpl __XEN_DHCP_STANZA__ "$CONST_XEN_DHCP_STANZA" \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+  VIF_STANZA=${VIF_STANZA}${EXTERNAL_MAC}"','"${INTERNAL_IP}","${INTERNAL_MAC}","${INTERNAL_BRIDGE}${CONST_XEN_VIF_STANZA_POSTFIX}
+else
+  # Comment out the DHCP_STANZA.
+  rpl __XEN_DHCP_STANZA__ "#$CONST_XEN_DHCP_STANZA" \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+  VIF_STANZA=${VIF_STANZA}${EXTERNAL_IP}","${EXTERNAL_MAC}",'"${INTERNAL_IP}","${INTERNAL_MAC},${INTERNAL_BRIDGE}${CONST_XEN_VIF_STANZA_POSTFIX}
+fi
+# In any case, write the VIF_STANZA
+rpl __VIF_STANZA__ "$VIF_STANZA" \
+   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Console stuff as extra parameter
+rpl __EXTRA_STANZA__ "$CONST_XEN_EXTRA_STANZA" \
+     $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# End creation of Xen configuration file.
+#
+# Complet installation
+#
+# Modules stuff.
+#
+#  Create the directory on the new image, if it does not exit yet.
+if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules ] ; then
+  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules
+fi
+#
+#  Copy the modules
+#
+XEN_MODULES_DIRECTORY=`ls /lib/modules | grep xen `
+for i in $XEN_MODULES_DIRECTORY ; do
+  cp -a /lib/modules/$i $FRONT_END_FILE_SYSTEM_MOUNT_POINT/lib/modules
+done
+#
+# Module stuff done.
+#
+# Generate or configure the specific files from templates
+#
+# Create the /etc directory, if necessary
+if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc ] ; then
+  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc
+fi
+# Copy the sources list
+if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt ] ; then
+  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt
+fi
+cp /etc/apt/sources.list $FRONT_END_FILE_SYSTEM_MOUNT_POINT/etc/apt
+
+# /etc/network/interfaces
+# The first interface is DHCP configured.
+# No '/' between $FRONT_END_FILE_SYSTEM_MOUNT_POINT and $CURRENT_PATH
+CURRENT_PATH=/etc/network
+if [ ! -d ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH} ] ; then
+  mkdir ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}
+fi
+cp templates$CURRENT_PATH/$FRONT_END_INTERFACES_TEMPLATE \
+   $FRONT_END_FILE_SYSTEM_MOUNT_POINT$CURRENT_PATH/interfaces
+if [ $CLUSTER_EXTERNAL_ADDRESSES_BY_DHCP -eq 1 ] ; then
+  ETH0_STANZA="iface eth0 inet dhcp"
+  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_ADDRESS__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_NETMASK__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_NETWORK__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_GATEWAY__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_BROADCAST__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_NAMESERVERS__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ "" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+else
+  ETH0_STANZA="iface eth0 inet static"
+  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_ADDRESS__ "$FRONT_END_CLUSTER_STATIC_IP" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_NETMASK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETMASK" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_NETWORK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETWORK" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+  echo y | rpl __ETH0_STATIC_GATEWAY__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_GATEWAY" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_BROADCAST__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_BROADCAST" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_NAMESERVERS__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_NAMESERVERS" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces 
+  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_SEARCH" \
+      ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+fi 
+# Static address on the cluster interface.
+ADDRESS="${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX}"
+rpl __ETH1_STATIC_ADDRESS__ $ADDRESS  \
+    ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+rpl __ETH1_STATIC_NETMASK__ $CLUSTER_STATIC_NETMASK  \
+    ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/interfaces
+    
+# /etc/hostname
+CURRENT_PATH=/etc
+echo $CURRENT_HOST_NAME > "${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/hostname"
+# /etc/hosts. Script generated.
+CURRENT_PATH=/etc
+$SCRIPT_PATH/generate-hosts-file \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/hosts
+# /etc/resolv.conf
+CURRENT_PATH=/etc
+cp $TEMPLATES_DIR$CURRENT_PATH/resolv.conf \
+   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
+rpl __CLUSTER_DOMAIN_NAME__ "${CLUSTER_DOMAIN_NAME}." \
+   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
+rpl __FRONT_END_STATIC_ADDRESS__ "${CLUSTER_STATIC_NETWORK_PREFIX}.${CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX}" \
+   ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
+#
+# /etc/fstab
+#
+CURRENT_PATH=/etc
+cp ${TEMPLATES_DIR}${CURRENT_PATH}/${FRONT_END_FSTAB_TEMPLATE} \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
+  # Front-End System Disk Line
+FESDL=${FRONT_END_SYSTEM_VIRTUAL_VOLUME_DEVICE}
+FESDL="$FESDL	/		$FRONT_END_SYSTEM_DISK_FILE_SYSTEM	errors=remount-ro	0	1"
+rpl __FRONT_END_SYSTEM_DISK_LINE__ "$FESDL" \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
+  # Font-End Home Disk Line
+FEHDL=${FRONT_END_HOME_VIRTUAL_VOLUME_DEVICE}
+FEHDL="$FEHDL	/home		$FRONT_END_HOME_DISK_FILE_SYSTEM	errors=remount-ro	0	2"
+rpl __FRONT_END_HOME_DISK_LINE__ "$FEHDL" \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
+  # Font-End Swap Disk Line
+if [ "x$FRONT_END_SWAP_DISK_SIZE" != "x$CONST_NULL_DISK_SIZE" ] ; then
+  FESDL=${FRONT_END_SWAP_VIRTUAL_VOLUME_DEVICE}
+  FESDL="$FESDL	none		swap				0	0"
+else
+  FESDL=""
+fi
+# "rpl -f" since $FESDL can be an empty string.
+rpl -f __FRONT_END_SWAP_DISK_LINE__ "$FESDL" \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
+#
+# End /etc/fstab stuff.
+#
+# /etc/inittab stuff
+#
+rpl tty1 "$CONST_XEN_VIRTUAL_CONSOLE_NAME" \
+  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/inittab
+#
+# Umount the compute node system disk
+#
+# Order matters since the /home file system is mounted on the
+# on the system partition
+umount $FRONT_END_FILE_SYSTEM_MOUNT_POINT/home
+umount $FRONT_END_FILE_SYSTEM_MOUNT_POINT
+#
+# Start the virtual machine
+#
+xm create $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+#
+exit 0
+#
+# Wait until the virtual machine has started
+#
+IS_RUNNING=""
+while [ -z "$IS_RUNNING" ]
+  do
+    IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME`
+    sleep 1
+done
+#
+# Pin the VCPUs to "real" CPUs.
+#
+VCPU_NUM=0
+for i in $CPUS_LIST
+  do
+    xm vcpu-pin $CURRENT_HOST_NAME $VCPU_NUM $i
+    VCPU_NUM=$((VCPU_NUM + 1))
+done
+
+exit 0

Property changes on: trunk/shell/front-end-finish-up
___________________________________________________________________
Added: svn:executable
   + *

Index: trunk/shell/front-end-create
===================================================================
--- trunk/shell/front-end-create	(revision 0)
+++ trunk/shell/front-end-create	(revision 37)
@@ -0,0 +1,78 @@
+#! /bin/bash -x
+#
+# ST - 2012-03-09
+#
+# Create the front end, up to basic system installation.
+#
+# Get the directory of the script.
+SCRIPT_PATH=`dirname $0`
+# Get the script name.
+SCRIPT_NAME=`basename $0`
+# Source the common configuration variables.
+. $SCRIPT_PATH/c-i-a-b.common
+#
+# Check that the front-end virtual machine does not already exist.
+#
+CURRENT_HOST_NAME=$FRONT_END_HOST_NAME
+IS_RUNNING=`xm list | grep $CURRENT_HOST_NAME`
+if [ -n "$IS_RUNNING" ]
+  then
+    echo
+    echo The \"$CURRENT_HOST_NAME\" domU already exists. Aborting!
+    echo
+    exit 1
+fi
+
+# Create the front-end system disk.
+lvcreate -L$FRONT_END_SYSTEM_DISK_SIZE \
+         -n  $FRONT_END_SYSTEM_DISK \
+         $FRONT_END_SYSTEM_VOLUME_GROUP
+# Create a File System on the front-end system disk.
+mkfs -t $FRONT_END_SYSTEM_DISK_FILE_SYSTEM \
+        $FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE/$FRONT_END_SYSTEM_DISK
+# If necessary, create the swap volume for the front end.
+if [ $FRONT_END_SWAP_DISK_SIZE != $CONST_NULL_DISK_SIZE ] ; then
+  lvcreate -L $FRONT_END_SWAP_DISK_SIZE \
+           -n $FRONT_END_SWAP_DISK \
+           $FRONT_END_SWAP_VOLUME_GROUP
+  mkswap $FRONT_END_SWAP_VOLUME_GROUP_DEVICE/$FRONT_END_SWAP_DISK
+fi
+# Create the VM home disk.
+lvcreate -L$FRONT_END_HOME_DISK_SIZE \
+         -n  $FRONT_END_HOME_DISK \
+         $FRONT_END_HOME_VOLUME_GROUP
+# Create a File System on the front-end system disk.
+mkfs -t $FRONT_END_HOME_DISK_FILE_SYSTEM \
+        $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK
+# Mount the system disk to install the system.
+if [ ! -d $FRONT_END_FILE_SYSTEM_MOUNT_POINT ]; then
+  mkdir $FRONT_END_FILE_SYSTEM_MOUNT_POINT
+fi
+mount $FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE/$FRONT_END_SYSTEM_DISK \
+      $FRONT_END_FILE_SYSTEM_MOUNT_POINT
+if [ $? -ne 0 ] ; then
+  exit 1
+fi 
+# Create the directory for the homes
+if [ ! -d "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home" ]; then
+  mkdir "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home"
+fi
+mount $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK \
+      "$FRONT_END_FILE_SYSTEM_MOUNT_POINT/home"
+
+#
+# Get the cluster MAC address
+#
+CURRENT_PATH=/etc
+FRONT_END_CLUSTER_MAC_ADDRESS=\
+`awk -F, -v INDEX=$CONST_FRONT_END_CLUSTER_STATIC_NETWORK_POSTFIX '{if (FNR==INDEX) {print $1}}' $SCRIPT_PATH/$TEMPLATES_DIR$CURRENT_PATH/$CONST_DHCP_HOSTS_FILE_BASENAME`
+#
+# Install the system.
+# 
+debootstrap --arch $CONST_DEBIAN_ARCH $CONST_DEBIAN_VERSION \
+    $FRONT_END_FILE_SYSTEM_MOUNT_POINT
+# exit 0
+#
+# Complete the installation
+#
+exit 0

Property changes on: trunk/shell/front-end-create
___________________________________________________________________
Added: svn:executable
   + *

