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