Monthly Archives: September 2012

Auto Start VMs on reboot

http://www.raido.be/knowledge-center/blog/detail/xenserver-6-auto-start-vms


# AutoStart VM's that are tagged with autostart tag
# Script created by Raido Consultants - http://www.raido.be
TAG="autostart" # helper function
function xe_param()
{
PARAM=$1
while read DATA; do
LINE=$(echo $DATA | egrep "$PARAM")
if [ $? -eq 0 ]; then
echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
fi
done
} # Get all VMs
sleep 20
VMS=$(xe vm-list is-control-domain=false | xe_param uuid) for VM in $VMS; do
echo "Raido AutoStart Script : Checking VM $VM"
VM_TAGS="$(xe vm-param-get uuid=$VM param-name=tags)" if [[ $VM_TAGS == *$TAG* ]]
then
echo "starting VM $VM"
sleep 20
xe vm-start uuid=$VM
fi done

or just do this:

sleep 30
xe vm-start tags=autostart –multiple

XenServer management

/etc/xensource-inventory

xenbr0

methods to reset management network.

xe host-management-disable
xe pif-list
xe pif-unplug uuid=
xe pif-forget uuid=uuid of PIF>
xe pif-introduce host-uuid= device= mac=
xe pif-plug uuid=
xe pif-reconfigure-ip uuid= mode=static IP= netmask= gateway= DNS=
xe host-management-reconfigure pif-uuid=