Name

VixPowerState

Description

These are the possible values reported for VIX_PROPERTY_VM_POWER_STATE property. These values are bitwise flags. The actual value returned for may be a bitwise OR of one more of these flags, along with other reserved values not documented here. They represent runtime information about the state of the virtual machine. To test the value of the property, use the Vix_GetProperties() function.

Values

VIX_POWERSTATE_POWERING_OFF
Indicates that VixVM_PowerOff() has been called, but the operation itself has not completed.

VIX_POWERSTATE_POWERED_OFF
Indicates that the virtual machine is not running.

VIX_POWERSTATE_POWERING_ON
Indicates that VixVM_PowerOn() has been called, but the operation itself has not completed.

VIX_POWERSTATE_POWERED_ON
Indicates that the virtual machine is running.

VIX_POWERSTATE_SUSPENDING
Indicates that VixVM_Suspend() has been called, but the operation itself has not completed.

VIX_POWERSTATE_SUSPENDED
Indicates that the virtual machine is suspended. Use VixVM_PowerOn() to resume the virtual machine.

VIX_POWERSTATE_TOOLS_RUNNING
Indicates that the virtual machine is running and the VMware Tools suite is active. See also the VixToolsState property.

VIX_POWERSTATE_RESETTING
Indicates that VixVM_Reset() has been called, but the operation itself has not completed.

VIX_POWERSTATE_BLOCKED_ON_MSG
Indicates that a virtual machine state change is blocked, waiting for user interaction.

Requirements

vix.h, since VMware Server 1.0.

Example

This example retrieves the power state of a virtual machine.
VixError err = VIX_OK;
VixHandle myVM = VIX_INVALID_HANDLE;
VixToolsState powerState = 0;

// ...Open the virtual machine and get a handle...

// Test the power state.
err = Vix_GetProperties(myVM,
                        VIX_PROPERTY_VM_POWER_STATE,
                        &powerState,
                        VIX_PROPERTY_NONE);
if (VIX_OK != err) {
  // Handle the error...
}

if (VIX_POWERSTATE_POWERED_ON & powerState) {
   // virtual machine is powered on
} else if (VIX_POWERSTATE_POWERED_OFF & powerState) {
   // virtual machine is powered off
}

Copyright (C) 2007-2008 VMware, Inc. All rights reserved.