[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] REQUEST - Power on after another VM was started
Hello, I would like know about your opinion about implement startup order on xenserver/xcp I did a little modification on "xapi-autostart-vms" file, idea is the next:
- other_config:auto_poweron now is false or true, for any reason seems not boolean, then i can use "false" as value - a two new fields on VM's other_config - 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 An example: xe vm-param-set uuid=df81d848-e246-8958-125e-ad53d72b32de other-config:auto_poweron=after xe vm-param-set uuid=df81d848-e246-8958-125e-ad53d72b32de other-config:auto_poweron_after=b2e6f6e0-c981-372e-10c0-a51bbc7164ec (or xe vm-param-set uuid=df81d848-e246-8958-125e-ad53d72b32de other-config:auto_poweron_after_tools=b2e6f6e0-c981-372e-10c0-a51bbc7164ec)
script modified is: #!/bin/sh # # 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 [ $? -eq 0 ]; then # 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`; do 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 exit 0 fi
for uuid in $UUIDS do # 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 fi done sleep 5 done
fi sorry my english
_______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |