[Nut-upsuser] early shutdown of VMware VMs

Jon Bendtsen jbendtsen at laerdal.dk
Fri Feb 13 16:01:29 UTC 2009


On 13/02/2009, at 16.48, David Newman wrote:

> On 2/12/09 11:19 PM, Arjen de Korte wrote:
>> Citeren David Newman <dnewman at networktest.com>:
>>
>>> How to shut down VMWare guest virtual machines earlier than the host
>>> machine they run on? (For example, if everything normally shuts  
>>> down at
>>> 5% UPS battery, then the VMs should shut down at 10%.)
>>
>> First question is, why do you want to do that?
>
> Because a clean shutdown of the VMs is more important than high uptime
> for the VMs.
>
> If both guest and host machines shut down at the same time, the host
> might finish its shutdown before the guests have, leading to possible
> filesystem corruption. I will gladly trade off some downtime of the  
> VMs
> to ensure clean shutdowns.
>
>
>>
>>> I also read upssched.txt but I can't tell from the early shutdown
>>> section which settings to use on the master and which on the slaves.
>>>
>>> This seems like a fairly standard problem -- are there sample  
>>> configs
>>> posted someplace?
>>
>> I'm not an expert on VMware, but I would expect that you can  
>> configure
>> on the host that it shuts down the guests before going down.
>
> Thanks -- that's what I'm asking for -- what is it that I configure,  
> and
> are there sample configs someplace that do this?

I think you have to ask on a VMware list how you configure the VMware
server to tell the VMware clients to shut down. Maybe just sending
ctrl+alt+delete is enough.

Or you could just use the notify command? Once ONBATT is reached,
then sleep for a 1 minute or more, and start the shutdown?
If you get a ONLINE then have the script check if all virtual machines
are running.

There might be a problem if the UPS has very little power left. So  
when you
get a LOWBATT execute a script that doesnt sleep but start the shutdown
now.

NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG ONLINE SYSLOG+EXEC

NOTIFYCMD /sbin/upsmail.sh

Then just include something that tells the virtual machines to shut  
down.
And install it on every vmware client unless you can instruct vmware to
shut the clients nicely down. Maybe tell vmware to sleep the machines
at ONBATT?



JonB




More information about the Nut-upsuser mailing list