VMware Cloud Community
FredericNass
Contributor
Contributor

Start VMs after power restore...

Hi,

I'm aware of this discussion but couldn't get any best practice answer from it : http://communities.vmware.com/thread/262476?start=15&tstart=0

As in a HA cluster configuration, it's not recommended to use the Auto Start / Stop VM feature of each ESX host (due to VMotion), how do you handle, at a cluster level, restarting some VMs when ESX hosts powers back on from a power failure ?

My cluster is configured that way :

When power failure occurs, my esx1 host monitors that event and ask each host in the cluster (by using ssh) to initiate a proper shutdown of all VMs running on it and then initiate it's proper shutdown. Then esx1 do the same and initiate its proper shutdown and ask to UPS to cut the power 2 minutes later.

When power gets back, the UPS delivers power back to each host and the hosts start to boot up. But then VMs remains shutdown.

I understand that as VMs were properly shutdown, we shouldn't blame HA for not power VMs on on the host reboot.

But how then could we properly shutdown VMs and hosts on power failures and power them back on on power return ??

I think VMware should provide a functionnality (related or not to HA), that would ask each hosts to power on the vcenter (on its own boot) if registered on that host, and the vCenter should allow to configure all VMs in the cluster to be automatically started if not already started.

I thought about a script that would run once on each ESX hosts upon boot tryng to start the vCenter, and configure vCenter to monitor VMs using HA, but that wouldn't to the trick... Also in the discussion above, some guy say that he asks the hosts to shutdown (but not the VMs) so that HA power them back on host reboot.

How do you guys handle this ?

Thanks for any help,

Mini.

0 Kudos
3 Replies
FredericNass
Contributor
Contributor

Hi,

Thanks for trying, but that's not relevant in a cluster configuration. Check the link above.

Mini.

0 Kudos
FredericNass
Contributor
Contributor

Well. I scripted all that the following way :

When /usr/local/bin/shutdown_esx.sh script is launched on a host due to a power failure event :

- touch /var/log/turned_off_by_ups && cat /dev/null > /var/log/vms_to_restart.log

- logs every running VMs in file /var/log/vms_to_restart.log

- shutdown each VMs

- shutdown host

When host boots up :

- /etc/rc.local is calling /usr/local/bin/host_return

- if file /var/log/turned_off_by_ups exists then start any VMs in file /var/log/vms_to_restart.log

- remove file /var/log/turned_off_by_ups

- Check if gateway VM is back then send a mail to admins to say host and which VMs are back.

Should work... Not tested.

Can't believe VMware doesn't provide something relevant here... Or did I miss something ?

Mini.

0 Kudos