#!/bin/bash
##
# For fresh installs the default is to enable multipathed SRs if the root disk is multipathed, 
# and to disable multipathed SRs otherwise.  This is just a default and can be changed later. 
# On upgrade the setting is left unchanged.
#
# The host-installer enables multipathed SRs by writing a config file in the firstboot data dir.

set -e

[ -e ${FIRSTBOOT_DATA_DIR}/sr-multipathing.conf ] && . ${FIRSTBOOT_DATA_DIR}/sr-multipathing.conf
. ${XENSOURCE_INVENTORY}

start() {

    if [ "$MULTIPATHING_ENABLED" = True ] ; then
	$XE host-param-set uuid=${INSTALLATION_UUID} other-config:multipathing=true
	$XE host-param-set uuid=${INSTALLATION_UUID} other-config:multipathhandle=dmp
    fi
}

case $1 in
    start)  start ;;
esac
