Xen Autostart VM

First approach is to set auto_poweron parameter to true at the pool and VM level.

Setting the XenServer to allow Auto-Start
1. Gather the UUID’s of the pools you wish to auto-start.
To get the list of the pool’s on your XenServer type

xe pool-list

2. Copy the UUID of the pool. If you have just one server, it will still have a pool UUID as bellow:
uuid ( RO) : d170d718-e0de-92fc-b920-f4c59cc62e91
name-label ( RW):
name-description ( RW):
master ( RO): 755d4ea3-373b-44b9-8ae3-3cd6f77a7f33
default-SR ( RW): 51218f44-6ac6-4893-98fb-f924b08f7af9
3. Set the pool or server to allow auto-start:

xe pool-param-set uuid=UUID other-config:auto_poweron=true

Note: *Replacing UUID with the UUID of the XenServer or pool.
Setting the Virtual Machines to Auto-Start
1. Gather the UUID’s of the Virtual Machine you want to auto-start by typing:
xe vm-list
Note: This generates a list of Virtual Machines in your pool or server and their associated UUID’s.

2. Copy the UUID of the Virtual Machines you want to auto-start, and type the following command for each Virtual Machine to auto-start:
xe vm-param-set uuid=UUID other-config:auto_poweron=true
Note: *Replace UUID with the UUID of the Virtual Machine to auto-start.*

For this second part (enabling auto-start for the VMs) we can use a little one-line script, which would enable autostart for ALL vms:

for i in `xe vm-list is-control-domain=false –minimal | tr , ‘ ’`; do xe vm-param-set uuid=$i other-config:auto_poweron=true; done
Edit rc.local file to start all vms with «auto_poweron» in their other-config

Add the following lines at the end of /etc/rc.local file:

[ -e /proc/xen ] || exit 0


# wait for xapi to complete initialisation for a max of XAPI_START_TIMEOUT_SECONDS
/opt/xensource/bin/xapi-wait-init-complete ${XAPI_START_TIMEOUT_SECONDS}

if [ $? -eq 0 ]; then

pool=$(xe pool-list params=uuid —minimal 2> /dev/null)

auto_poweron=$(xe pool-param-get uuid=${pool} param-name=other-config param-key=auto_poweron 2> /dev/null)
if [ $? -eq 0 ] && [ «${auto_poweron}» = «true» ]; then
logger «$0 auto_poweron is enabled on the pool— this is an unsupported configuration.»

# 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

Second approach is to use vApp

1. Create vApp
2. Choose vms to vApp
3. Choose boot order and delays between starts
4. To get uuid of vApp use:

xe appliance-list name-label=»name-vapp»
5. Edit rc.local file to start vApp:

echo «sleep 40» >> /etc/rc.local
echo «xe appliance-start uuid=uuid-vapp» >> /etc/rc.local

7. Save file, reboot XenServer

Tkns, http://sysadmin.compxtreme.ro/autostart-vm-in-free-version-of-xenserver-6-x/

  1. Пока комментариев нет.

  1. Пока что обратных ссылок нет.