How to make ESXi 5.0 to shutdown virtual machines when the physical power button is pushed

acpiesxipower-managementshutdown

I have a home NAS/DLNA server built out of an HP Micro Server with the HP branded VMware ESXi 5.0.0 build-623860 (free license) installed. Being a home media center I'd like it to be "manageable" by all my household members. This requires that it needs to be powered on an off (including all the VMs inside) by anybody with the physical access to the server by simply pressing the power button on the chassis.

The "startup" part is easy to obtain – all I had to do was to configure the startup/shutdown policy:

VM startup/shutdown configuration

Once the server powers up, all VMs start as well and that's exactly what I need. Well.. it did work up until 5.0.0U1, but that's a different story:

http://blogs.vmware.com/vsphere/2012/03/free-esxi-hypervisor-auto-start-breaks-with-50-update-1.html

Unfortunately, pressing the power button doesn't gracefully shutdown the guest machines – they are terminated instead.

If I run the "shut down" command from the vSphere Client interface guests are powered off. I'd like to get the same end result when the physical power button is switched.

I've poked around a bit on the ESXi server. There's a "/sbin/shutdown.sh" script that seemed to do exactly what I need… but after trying it does exactly what the power off button. The "/etc/inittab" contains an entry for the "shutdown" level but I suppose it's not hooked to the power button. I can't find any acpi related configuration, neither do I know what exactly is executed when the power button is pressed.

Does anybody have a clue how can I make the VMs shutdown automatically when the physical power switch is pressed to turn of the computer?

Best Answer

You can't - oddly enough this professional grade software is not geared towards your decidedly home-based usage requirement - therefore it does not have any form of code built in to detect a button press and trigger a shutdown.

Why not try a consumer product such as VMWare's Workstation which is much more likely to be scriptable in this manner.

Related Question