3

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?

0

1 Answer 1

3

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.

3
  • 1
    After a bit of a research I found out that the physical power switch runs the '/sbin/poweroff' command (which is a symlink to /bin/busybox). After poking around the '/sbin/shutdown.sh' and 'vim-cmd' I finally ended up with a wrapper script that behaves exactly as if I issued the shutdown from vSphere client - full success :) And the reason why I didn't want to use VMware Workstation is that I don't need an extra layer of the full-blown OS - a bare iron hypervisor (ESXi) is all I need. Thanks @Chopper3 for making it an ambitious project for me :)
    – pjsawicki
    Commented Jun 5, 2012 at 21:37
  • 1
    @PawelSawicki would you mind writing up a little guide on how to do it? I'm facing the same problem you were. Thanks
    – waspinator
    Commented Sep 25, 2012 at 1:31
  • @waspinator I'm sorry but I can't :( I reinstalled the whole setup and put an Archlinux OS there. There were too many problems in tweaking the free version of VMware ESXi so I passed. The script was simple, hence I haven't saved it anywhere. In a nutshell, you need to create a shell script and put it in place of the symlink /sbin/poweroff. Inside, you need to gracefully shutdown all VMs and then /sbin/shutdown.sh the ESXi. See this VMware KB Powering off a virtual machine on an ESXi host
    – pjsawicki
    Commented Oct 6, 2012 at 19:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .