WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] REQUEST - Power on after another VM was started

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] REQUEST - Power on after another VM was started
From: Alberto González Rodríguez <alberto@xxxxxxxxxxxxx>
Date: Tue, 21 Dec 2010 12:10:24 +0100
Delivery-date: Tue, 21 Dec 2010 03:10:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>