Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Automating the process of starting and stopping virtual machines on VMware ESX (850)

Details

This article explains how to configure the virtual machines to start and stop automatically when powering an ESX Server host on and off. These settings are set on a per host basis. If you vMotion the virtual machine off the host, the settings are not retained.

Solution

ESX 4.x and ESXi 5.0

VMware vCenter 4.x and 5.x includes the ability to configure startup ordering. To configure these startup options:

Note: The Virtual Machine Startup and Shutdown (automatic startup) feature is disabled for all virtual machines residing on hosts that are in (or moved into) a VMware HA cluster. Automatic startup is not supported when used with VMware HA.
This issue is resolved in vCenter Server 5.0 Update 1.

  1. Access the settings:
    1. Give focus to the host in vCenter.
    2. Select the Configuration tab.
    3. Select Virtual Machine Startup / Shutdown under Software.
    4. Click Properties in the upper right hand side of the window.

  2. Select the options you want:
    1. In order to be able to configure any options, enable Allow virtual machines to start and stop automatically with the system.
    2. Enter a value for the Default Startup Delay, in order to delay the startup activity for a period of time after the boot process completes.
    3. Enter a value for the Default Startup Delay, in order to delay the startup activity for a period of time after the boot process completes. Select which Shutdown Action you want to occur:

      • Guest Shutdown, to shut down the guest gracefully. This requires up to date VMware Tools to be installed in the guest.
      • Power off, to abruptly stops power to the virtual machine, like pulling the power cord on a physical machine
      • Suspend, to pause the virtual machine at that moment in time, like hibernating a physical machine

    4. To start up the virtual machines in a particular order, configure the three Startup Order categories:

      • Automatic: This category allows you to choose the sequence, by moving machines into this category, then arranging them in order.
      • Any order: In this category, the machines are started in whatever sequence the host prefers (more or less randomized).
      • Manual: In this category, the default, the machines are not automatically restarted. You must power them on manually.

  3. Click OK when finished.

VMware ESX 3.0 and 3.5

You can manage startup and shutdown options using the VMware Infrastructure or vSphere client.

To manage virtual machine startup and shutdown options:

  1. Log into the client and select an ESX host from the inventory.
  2. Click the Configuration tab.
  3. Under Virtual Machine Startup/Shutdown, configure your virtual machine startup options, as required.

Using vmware-cmd for ESX Server 2.1 and 2.5

Starting with ESX Server 2.1, the Management Interface provides start and stop options for virtual machines. The script vmstartstop.pl was also removed and the functions provided by that script were incorporated into vmware-cmd.

For more information, see Setting Startup and Shutdown Options for a Virtual Machine in the ESX Server 2.5 Administration Guide.

The VMware Scripting API User's Manual discusses vmware-cmd command syntax. For more information, see www.vmware.com/support/developer/scripting-API/.

Using vmstartstop.pl for ESX Server 2.0.1 and earlier versions

To automatically start virtual machines, add one of these configuration options to the virtual machine's configuration (.cfg or .vmx) file:

  • autostart = true
  • autostart = poweron
  • autostart = resume

    Notes:
    • The true and poweron settings are treated the same.
    • Use the resume setting if you have suspended the virtual machine and want it to resume automatically.

The vmware init script calls /usr/sbin/vmstartstop.pl script. This script looks for virtual machines listed in vm-list that contain one of the above options in their configuration files.

If you want to automatically shut down or suspend the virtual machine as well, add one of these configuration options to the virtual machine's configuration file:

  • autostop = suspend
  • autostop = poweroff

To stagger the startup of virtual machines, add this option to each virtual machine's configuration file:

autostart.delay = n

where n is the number of seconds ESX Server waits after powering on this virtual machine before it proceeds to the next virtual machine.

Example: If you add the option autostart delay = 60, ESX waits one minute after it starts this virtual machine before starting the next virtual machine.

The same is true for automatically stopping the virtual machines. Use this configuration option:

autostop.delay = n

Notes:

  • You can set a maximum delay of two minutes (120 seconds) between stopping each virtual machine.
  • The stop script loops for up to a maximum of five minutes, until all virtual machines are stopped.
  • This information is documented in the comments in the /usr/sbin/vmstartstop.pl file.

Tags

virtual-machine-start-stop

Keywords

URLZ; 850; Autostop; Autostart; startup; shutdown

Update History

10/05/2010 - Added steps for ESX 3.x 07/13/2011 - Added steps for ESX 4.x

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 9 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 9 Ratings
Actions
KB: