XenAPI: Move some boot-time functions to install-time
The boot-time script (prepare_guest.sh) is one of the less reliable parts
of the install process. This change enables SSH into the host as well as
reporting of the IP address. This significantly helps debugging issues
now and enables moving of all other setup code to being executed over SSH.
Change-Id: I1555f1d91353ba8b75e2de4607df33ee20307a6e
diff --git a/tools/xen/prepare_guest_template.sh b/tools/xen/prepare_guest_template.sh
index 6cb2ca7..6cdddda 100755
--- a/tools/xen/prepare_guest_template.sh
+++ b/tools/xen/prepare_guest_template.sh
@@ -46,28 +46,6 @@
exit 1
fi
-# Copy XenServer tools deb into the VM
-ISO_DIR="/opt/xensource/packages/iso"
-XS_TOOLS_FILE_NAME="xs-tools.deb"
-XS_TOOLS_PATH="/root/$XS_TOOLS_FILE_NAME"
-if [ -e "$ISO_DIR" ]; then
- TOOLS_ISO=$(ls -1 $ISO_DIR/xs-tools-*.iso | head -1)
- TMP_DIR=/tmp/temp.$RANDOM
- mkdir -p $TMP_DIR
- mount -o loop $TOOLS_ISO $TMP_DIR
- DEB_FILE=$(ls $TMP_DIR/Linux/*amd64.deb)
- echo "Copying XenServer tools into VM from: $DEB_FILE"
- cp $DEB_FILE "${STAGING_DIR}${XS_TOOLS_PATH}"
- umount $TMP_DIR
- rm -rf $TMP_DIR
-else
- echo "WARNING: no XenServer tools found, falling back to 5.6 tools"
- TOOLS_URL="https://github.com/downloads/citrix-openstack/warehouse/xe-guest-utilities_5.6.100-651_amd64.deb"
- curl --no-sessionid -L -o "$XS_TOOLS_FILE_NAME" $TOOLS_URL
- cp $XS_TOOLS_FILE_NAME "${STAGING_DIR}${XS_TOOLS_PATH}"
- rm -rf $XS_TOOLS_FILE_NAME
-fi
-
# Copy prepare_guest.sh to VM
mkdir -p $STAGING_DIR/opt/stack/
cp $TOP_DIR/prepare_guest.sh $STAGING_DIR/opt/stack/prepare_guest.sh
@@ -79,14 +57,10 @@
cat <<EOF >$STAGING_DIR/etc/rc.local
#!/bin/sh -e
bash /opt/stack/prepare_guest.sh \\
- "$GUEST_PASSWORD" "$XS_TOOLS_PATH" "$STACK_USER" "$DOMZERO_USER" \\
+ "$GUEST_PASSWORD" "$STACK_USER" "$DOMZERO_USER" \\
> /opt/stack/prepare_guest.log 2>&1
EOF
-# Need to set barrier=0 to avoid a Xen bug
-# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/824089
-sed -i -e 's/errors=/barrier=0,errors=/' $STAGING_DIR/etc/fstab
-
# Update ubuntu repositories
cat > $STAGING_DIR/etc/apt/sources.list << EOF
deb http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY} ${UBUNTU_INST_RELEASE} main restricted