- other_config:auto_poweron now is false or true, for any reason seems not boolean, then i can use "false" as value
�� � - auto_poweron_after: contains a vm uuid, if this value has a vm uuid, then is started when vm on auto_poweron_after field is in state "running"
�� � - auto_poweron_after_tools, contains a vm uuid, if this value has a vm uuid, then is started when vm on auto_poweron_after field has the field "live" in true
# Copyright (c) Citrix Systems 2008. All rights reserved.
# wait for xapi initialisation to complete.
# Then, if initialisation did complete, �attempt to start all vms
# with "auto_poweron" in their other-config
[ -e /proc/xen ] || exit 0
XAPI_START_TIMEOUT_SECONDS=240
# wait for xapi to complete initialisation for a max 4 minutes
/opt/xensource/bin/xapi-wait-init-complete ${XAPI_START_TIMEOUT_SECONDS}
�� �# if xapi init completed then start vms (best effort, don't report errors)
�� �xe vm-start other-config:auto_poweron=true power-state=halted --multiple >/dev/null 2>/dev/null || true
�� �# 120 seconds should be a generous time�
�� �for i in `/usr/bin/seq 1 24`;
�� � � � � �UUIDS=$(/opt/xensource/bin/xe vm-list other-config:auto_poweron=after power-state=halted | /bin/grep ^uuid | /bin/awk '{print $5}')
�� � � � � �# If there are not vm with power state halted and auto_poweron=after, exit with 0
�� � � � � �if [ -z "$UUIDS" ]; then �
�� � � � � �for uuid in $UUIDS�
�� � � � � � � �# Fields are "auto_poweron_after" and "auto_poweron_after_tools" and contains vm uuid
�� � � � � � � �AFTER=$(/opt/xensource/bin/xe vm-param-get uuid=${uuid} param-name=other-config param-key=auto_poweron_after 2>/dev/null)
�� � � � � � � �AFTERTOOLS=$(/opt/xensource/bin/xe vm-param-get uuid=${uuid} � param-name=other-config param-key=auto_poweron_after_tools 2>/dev/null)
�� � � � � � � �if [ "x$AFTER" != "x" ]; � � � �then
�� � � � � � � � � � � �STATE=$(/opt/xensource/bin/xe vm-param-get uuid=${AFTER} param-name=power-state 2>/dev/null)
�� � � � � � � � � � � �# Start if vm is running
�� � � � � � � � � � � �if [ "$STATE" == "running" ]; then
�� � � � � � � � � � � � � �/opt/xensource/bin/xe vm-start uuid=${uuid}
�� � � � � � � � � � � �fi
�� � � � � � � �elif [ "x$AFTERTOOLS" != "x" ]; then
�� � � � � � � � � � � �STATE=$(/opt/xensource/bin/xe vm-param-get uuid=${AFTERTOOLS} param-name=live 2>/dev/null)
�� � � � � � � � � � � �# Start xen tools are running
�� � � � � � � � � � � �if [ "$STATE" == "true" ]; then
�� � � � � � � � � � � � � �/opt/xensource/bin/xe vm-start uuid=${uuid}
�� � � � � � � � � � � �fi