Monthly Archives: September 2012

Auto Start VMs on reboot

# AutoStart VM's that are tagged with autostart tag
# Script created by Raido Consultants -
TAG="autostart" # helper function
function xe_param()
while read DATA; do
LINE=$(echo $DATA | egrep "$PARAM")
if [ $? -eq 0 ]; then
echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
} # 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* ]]
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



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=