[Nut-upsuser] early shutdown of VMware VMs
Arnaud Quette
aquette.dev at gmail.com
Thu Feb 26 11:03:14 UTC 2009
Hi David,
just a forward to the list since others might be interested in that info.
2009/2/25 David Newman <dnewman at networktest.com>
> On 2/17/09 5:26 AM, Arnaud Quette wrote:
> >
> > I've appended a script excerpt I've once made to address the guest
> > shutdown from the host.
> > it was for ESX, and at that time, I was really surprised to not see
> > anything to address automagically an ordered shutdown (of the VMs)...
> > hope this helps.
>
> Thanks for this -- it is helpful.
>
> For VMWare Server 2 (and probably future versions of ESX) there is a new
> VIX API that replaces vmware-cmd.
>
> VIX has a bunch of stuff I haven't tried yet, but I do know hosts start
> and stop using the vmrun command. The syntax for starting a guest host
> is like this:
>
> vmrun -T server -h https://myvmhost:8333/sdk -u root -p <password> start
> "[standard] vmware/FreeBSD.vmx"
>
> dn
>
>
> >
> > Arnaud
> > --
> > Linux / Unix Expert R&D - Eaton - http://www.eaton.com/mgeops
> > Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
> > Debian Developer - http://people.debian.org/~aquette/<http://people.debian.org/%7Eaquette/>
> > Free Software Developer - http://arnaud.quette.free.fr/
> >
> > 2009/2/14 Doug Parsons <doug at parsonsemail.com
> > <mailto:doug at parsonsemail.com>>
> >
> > >Thanks, Doug. I'm newly on VMWare Server 2, which has different
> tools
> > >than the 1.x ones I'm familiar with. AFAIK the 1.x tools did not
> have
> > >any sort of UPS or shutdown awareness capability; I'll need to check
> > >whether that's true with 2.x.
> > >
> > >dn
> >
> >
> > Unfortunately Server is the only version that I don't have running
> > anymore.
> > But as Arjen noted most versions can handle the guest shutdown
> > natively. One
> > catch is that this extends the shutdown and startup times quite a
> > bit and so
> > the battery level at which you start the shutdown would need to be
> > higher.
> > Another catch I believe is that the guest must be running the VMWare
> > tools.
> > If VMWare Server can't do it (check under the advanced tab) then you
> may
> > want to consider VMWare 3i as it can and is also free. Hit the
> > VMWare forums
> > as they should be able to fill in all the details.
> >
> > Doug
> >
> >
> >
> > # Customisable Vmware ESX shutdown
> > stopVMWare()
> > {
> > # Test if we have a Vmware ESX v3 setup
> > if [ -x /usr/bin/vmware ]
> > then
> > ESXV3=`/usr/bin/vmware -v | grep "ESX Server 3"`
> > if [ -n "$ESXV3" ]
> > then
> > # Get the VM list
> > VMLIST=`/usr/bin/vmware-cmd -l`
> >
> > for VM in $VMLIST
> > do
> > # Get the VM state
> > VMSTATE=`/usr/bin/vmware-cmd "$VM" getstate -q`
> >
> > # Guest OS shutdown if VMSTATE is equal to "on"
> > if [ "$VMSTATE" == "on" ]
> > then
> > /usr/bin/vmware-cmd "$VM" stop trysoft
> >
> > # delay a bit the next sequence
> > sleep 2
> > fi
> > done
> > # Delay for 1 minute to give the VMs more time
> > # to cleanly shutdown
> > sleep 60
> > fi
> > fi
> > }
>
>
cheers,
Arnaud
--
Linux / Unix Expert R&D - Eaton - http://www.eaton.com/mgeops
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
Free Software Developer - http://arnaud.quette.free.fr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20090226/d8667cc4/attachment-0001.htm
More information about the Nut-upsuser
mailing list