@Sample(name="vm-power-ops",
description="Demonstrates VirtualMachine Power operations on multiple Virtual Machines. Works with groups of Virtual Machines all at one time. You must specify one of --vmname or --datacentername or --hostname or --all all Virtual Machines that match these criteria will have the power operation issued to them. For example to power off all the virtual machines visible use the options --operation poweroff --all true together and all virtual machines will be turned off.")
public class VMPowerOps
extends ConnectedVimServiceBase
VMPowerOps
Demonstrates VirtualMachine Power operations on multiple Virtual Machines.
Works with groups of Virtual Machines all at one time.
Parameters:
url [required] : url of the web service
username [required] : username for the authentication
password [required] : password for the authentication
operation [required] : type of the operation
[poweron | poweroff | reset | suspend |
reboot | shutdown | standby]
datacentername [optional] : name of the datacenter
guestid [optional] : guest id of the vm
hostname [optional] : name of the host
vmname [optional] : name of the virtual machine, use this option to send the power operation to only one virtual machine
all [optional] : perform power operations on ALL virtual machines under our control. defaults to false. [true|false]
Command Line:
run.bat com.vmware.vm.VMPowerOps --url [URLString] --username [User] --password [Password]
--operation [Operation] --datacenter [DatacenterName]--guestid [GuestId] --hostname [HostName]
--vmname [VMName] --all [true|false]
ConnectedVimServiceBase.ConnectionExceptionPROP_ME_NAME, SVC_INST_NAME| Constructor and Description |
|---|
VMPowerOps() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkOptions()
The user must specify one of vmName or datacenter or host ...
|
void |
run() |
void |
setAll(java.lang.Boolean flag) |
void |
setDatacenter(java.lang.String datacenter) |
void |
setGuestId(java.lang.String guestId) |
void |
setHost(java.lang.String host) |
void |
setOperation(java.lang.String operation) |
void |
setVmName(java.lang.String vmName) |
basicConnectionFromConnection, connect, disconnect, getServiceInstanceReference, setConnection, setHostConnection@Option(name="operation",
description="type of the operation\n[poweron | poweroff | reset | suspend | reboot | shutdown | standby]")
public void setOperation(java.lang.String operation)
@Option(name="datacentername",
required=false,
description="name of the datacenter. use this option to send power operations to all the virtual machines in an entire data center.")
public void setDatacenter(java.lang.String datacenter)
@Option(name="guestid",
required=false,
description="guest id of the vm. use this option to send power operations to a single guest.")
public void setGuestId(java.lang.String guestId)
@Option(name="hostname",
required=false,
description="name of the host. use this option to send power operations to all the virtual machines on a single host.")
public void setHost(java.lang.String host)
@Option(name="vmname",
required=false,
description="name of the virtual machine. Use this option to send power operations to only this virtual machine.")
public void setVmName(java.lang.String vmName)
@Option(name="all",
required=false,
description="set to true to send power operation to all virtual machines that can be found. overrides all other options.")
public void setAll(java.lang.Boolean flag)
@Action
public void run()
throws com.vmware.vim25.RuntimeFaultFaultMsg,
com.vmware.vim25.InvalidPropertyFaultMsg
com.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.InvalidPropertyFaultMsgpublic boolean checkOptions()