Performing Virtual Machine Power Operations

You can start, stop, reboot, and suspend virtual machines by using the methods of the
Power
class.
A virtual machine can have one of the following power states:
  • PowerTypes.State.POWERED_ON
    - Indicates that the virtual machine is running. If a guest operating system is not currently installed, you can perform the guest OS installation in the same way as for a physical machine.
  • PowerTypes.State.POWERED_OFF
    - Indicates that the virtual machine is not running. You can still update the software on the physical disk of the virtual machine, which is impossible for physical machines.
  • PowerTypes.State.SUSPENDED
    - Indicates that the virtual machine is paused and can be resumed. This state is the same as when a physical machine is in standby or hibernate state.
To perform a power operation on a virtual machine, you can use one of the methods of the
Power
class. Before you call one of the methods to change the power state of a virtual machine, you must first check the current state of the virtual machine by using the
Power.get
method. Pass as argument the virtual machine identifier.
Following is a list if the power operations:
  • Power.start
    - Powers on a powered off or suspended virtual machine. The method takes as argument the virtual machine identifier.
  • Power.stop
    - Powers off a powered on or suspended virtual machine. The method takes as argument the virtual machine identifier.
  • Power.suspend
    - Pauses all virtual machine activity for a powered on virtual machine. The method takes as argument the virtual machine identifier.
  • Power.reset
    - Shuts down and restarts the guest operating system without powering off the virtual machine. Although this method functions as a
    stop
    method that is followed by a
    start
    method, the two operations are atomic with respect to other clients, meaning that other power operations cannot be performed until the
    reset
    method completes.