Index: create-start-front-end
===================================================================
--- create-start-front-end	(revision 33)
+++ create-start-front-end	(revision 34)
@@ -50,6 +50,9 @@
 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"
@@ -64,214 +67,12 @@
 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__ "$CONST_XEN_SYSTEM_DISK_ROOT_DEVICE" \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-#
-rpl __FRONT_END_SYSTEM_DISK__ $FRONT_END_SYSTEM_VOLUME_GROUP_DEVICE/$FRONT_END_SYSTEM_DISK \
-   $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-rpl __FRONT_END_HOME_DISK__ $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK \
-   $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},xvda3,w',"
-  rpl __FRONT_END_SWAP_DISK__ $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__ "" \
-     $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
-#
 # Install the system.
 # 
 debootstrap --arch $CONST_DEBIAN_ARCH $CONST_DEBIAN_VERSION \
     $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-exit 0
+# exit 0
 #
-# Complet installation
+# Complete the installation
 #
-# Modules stuff.
-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
-# 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
-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 
-ADDRESS="$CLUSTER_STATIC_NETWORK_PREFIX.$FRONT_END_STATIC_NETWORK_POSTFIX"
-rpl __ETH1_STATIC_ADDRESS__ $ADDRESS  \
-    ${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_VOLUME_GROUP_DEVICE}/${FRONT_END_SYSTEM_DISK}
-FESDL="$FESDL	/	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_DISK_VOLUME_GROUP_DEVICE}/${FRONT_END_HOME_DISK}
-FEHDL="$FEHDL	/	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_VOLUME_GROUP_DEVICE}/${FRONT_END_SWAP_DISK}
-  FESDL="$FESDL		none	swap		0	0"
-else
-  FESDL=""
-fi
-rpl __FRONT_END_SWAP_DISK_LINE__ "$FESDL" \
-  ${FRONT_END_FILE_SYSTEM_MOUNT_POINT}${CURRENT_PATH}/fstab
-
-#
-# Umount the compute node system disk
-#
-umount $FRONT_END_FILE_SYSTEM_MOUNT_POINT
-#
-# 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
