[Nut-upsuser] NUT on VMWare ESX?...

Arnaud Quette aquette.dev at gmail.com
Thu Jan 18 15:07:39 CET 2007


2007/1/18, Steve Loughran <stevelml1 at scee.sony.co.uk>:
> Hi
>
> Having used NUT for many years (Irix/Linux/Solaris/win32), but only used
> VMWare ESX v3 for about 4 weeks, what scripted command are you telling
> NUT to run to tell ESX to shutdown/suspend the VMs before it really
> powers itself down? (Not sure calling "shutdown" would be such a good
> idea :)

I'm not at all en ESX expert, but from what I know, VMs are brought up
automatically at vmware startup, but not shutdown.

Below is a code snipped that iterate on all VM and try to shut these
down softly:

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
    fi
  fi
}

hope this help,
Arnaud
-- 
Linux / Unix Expert - MGE UPS SYSTEMS - R&D Dpt
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
OpenSource Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsuser mailing list