Package com.vmware.vm
Class VMPowerOps
- java.lang.Object
-
- com.vmware.connection.ConnectedVimServiceBase
-
- com.vmware.vm.VMPowerOps
-
@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 ConnectedVimServiceBaseVMPowerOps 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]
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vmware.connection.ConnectedVimServiceBase
ConnectedVimServiceBase.ConnectionException
-
-
Field Summary
-
Fields inherited from class com.vmware.connection.ConnectedVimServiceBase
PROP_ME_NAME, SVC_INST_NAME
-
-
Constructor Summary
Constructors Constructor Description VMPowerOps()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckOptions()The user must specify one of vmName or datacenter or host ...voidrun()voidsetAll(java.lang.Boolean flag)voidsetDatacenter(java.lang.String datacenter)voidsetGuestId(java.lang.String guestId)voidsetHost(java.lang.String host)voidsetOperation(java.lang.String operation)voidsetVmName(java.lang.String vmName)-
Methods inherited from class com.vmware.connection.ConnectedVimServiceBase
basicConnectionFromConnection, connect, disconnect, getServiceInstanceReference, setConnection, setHostConnection
-
-
-
-
Method Detail
-
setOperation
@Option(name="operation", description="type of the operation\n[poweron | poweroff | reset | suspend | reboot | shutdown | standby]") public void setOperation(java.lang.String operation)
-
setDatacenter
@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)
-
setGuestId
@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)
-
setHost
@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)
-
setVmName
@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)
-
setAll
@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)
-
run
@Action public void run() throws com.vmware.vim25.RuntimeFaultFaultMsg, com.vmware.vim25.InvalidPropertyFaultMsg- Throws:
com.vmware.vim25.RuntimeFaultFaultMsgcom.vmware.vim25.InvalidPropertyFaultMsg
-
checkOptions
public boolean checkOptions()
The user must specify one of vmName or datacenter or host ... We add this check here to help prevent programmers from power cycling all the virtual machines on their entire vCenter server on accident.
-
-