Managed Object - Task

Property of
ClusterAttemptedVmInfo, ManagedEntity, ScheduledTaskInfo, StoragePlacementResult, TaskInfo, TaskInProgress, TaskManager
Returned by
AddDVPortgroup_Task, AddHost_Task, AddStandaloneHost_Task, ApplyHostConfig_Task, ApplyStorageDrsRecommendation_Task, ApplyStorageDrsRecommendationToPod_Task, CheckAnswerFileStatus_Task, CheckCompatibility_Task, CheckCompliance_Task, CheckHostPatch_Task, CheckMigrate_Task, CheckProfileCompliance_Task, CheckRelocate_Task, CloneVApp_Task, CloneVM_Task, ConfigureDatastoreIORM_Task, ConfigureHostCache_Task, ConfigureStorageDrsForPod_Task, ConsolidateVMDisks_Task, CopyDatastoreFile_Task, CopyVirtualDisk_Task, CreateChildVM_Task, CreateDVPortgroup_Task, CreateDVS_Task, CreateScreenshot_Task, CreateSecondaryVM_Task, CreateSnapshot_Task, CreateVirtualDisk_Task, CreateVM_Task, CustomizeVM_Task, DatastoreExitMaintenanceMode_Task, DefragmentVirtualDisk_Task, DeleteDatastoreFile_Task, DeleteVirtualDisk_Task, Destroy_Task, DisableSecondaryVM_Task, DisconnectHost_Task, DVPortgroupRollback_Task, DVSManagerExportEntity_Task, DVSManagerImportEntity_Task, DVSRollback_Task, EagerZeroVirtualDisk_Task, EnableSecondaryVM_Task, EnterMaintenanceMode_Task, EstimateStorageForConsolidateSnapshots_Task, ExitMaintenanceMode_Task, ExportAnswerFile_Task, ExtendVirtualDisk_Task, GenerateLogBundles_Task, ImportCertificateForCAM_Task, InflateVirtualDisk_Task, InstallHostPatch_Task, InstallHostPatchV2_Task, JoinDomain_Task, JoinDomainWithCAM_Task, LeaveCurrentDomain_Task, MakePrimaryVM_Task, MergeDvs_Task, MigrateVM_Task, MoveDatastoreFile_Task, MoveDVPort_Task, MoveHostInto_Task, MoveInto_Task, MoveIntoFolder_Task, MoveVirtualDisk_Task, PerformDvsProductSpecOperation_Task, PowerDownHostToStandBy_Task, PowerOffVApp_Task, PowerOffVM_Task, PowerOnMultiVM_Task, PowerOnVApp_Task, PowerOnVM_Task, PowerUpHostFromStandBy_Task, PromoteDisks_Task, QueryHostPatch_Task, QueryVMotionCompatibilityEx_Task, RebootHost_Task, ReconfigureCluster_Task, ReconfigureComputeResource_Task, ReconfigureDatacenter_Task, ReconfigureDVPort_Task, ReconfigureDVPortgroup_Task, ReconfigureDvs_Task, ReconfigureHostForDAS_Task, ReconfigVM_Task, ReconnectHost_Task, RectifyDvsHost_Task, RectifyDvsOnHost_Task, RegisterChildVM_Task, RegisterVM_Task, reloadVirtualMachineFromPath_Task, RelocateVM_Task, RemoveAllSnapshots_Task, RemoveSnapshot_Task, Rename_Task, ResetVM_Task, ResignatureUnresolvedVmfsVolume_Task, RevertToCurrentSnapshot_Task, RevertToSnapshot_Task, ScanHostPatch_Task, ScanHostPatchV2_Task, SearchDatastore_Task, SearchDatastoreSubFolders_Task, ShrinkVirtualDisk_Task, ShutdownHost_Task, StageHostPatch_Task, StartRecording_Task, StartReplaying_Task, StopRecording_Task, StopReplaying_Task, SuspendVApp_Task, SuspendVM_Task, TerminateFaultTolerantVM_Task, TurnOffFaultToleranceForVM_Task, UninstallHostPatch_Task, UnregisterAndDestroy_Task, unregisterVApp_Task, UpdateAnswerFile_Task, UpdateDVSHealthCheckConfig_Task, UpdateVirtualMachineFiles_Task, UpgradeTools_Task, UpgradeVM_Task, ZeroFillVirtualDisk_Task
Extends
ExtensibleManagedObject
See also
LocalizableMessage, MethodFault, TaskInfo, TaskInfoState


Managed Object Description

A task is used to monitor and potentially cancel long running operations.

Properties

Name Type Description
infoTaskInfo

Detailed information about this task.
Properties inherited from ExtensibleManagedObject
availableField, value

Methods

Methods defined in this Managed Object
CancelTask, SetTaskDescription, SetTaskState, UpdateProgress
Methods inherited from ExtensibleManagedObject
setCustomValue

CancelTask

Cancels a running or queued task. A task may only be canceled if it is cancelable. Multiple cancel requests will be treated as a single cancelation request. Canceling a completed or already canceled task will throw an InvalidState exception.

If a task is canceled, its runtime state will be set to error and its error state will be set to RequestCanceled.

A cancel operation is asynchronous. The operation may return before the task is canceled.

Required Privileges
Global.CancelTask

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the Task used to make the method call.

Return Value

Type Description
None

Faults

Type Description
InvalidStateThrown if the task is already canceled or completed.
NotSupportedThrown if the task is not cancelable.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition



SetTaskDescription

Updates task description to describe the current phase of the task.

Required Privileges
Task.Update
Since
vSphere API 4.0

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the Task used to make the method call.
descriptionLocalizableMessage

New description for task

Return Value

Type Description
None

Faults

Type Description
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition



SetTaskState

Sets task state and optionally sets results or fault, as appropriate for state

Required Privileges
Task.Update
Since
VI API 2.5

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the Task used to make the method call.
stateTaskInfoState

New state for task
result*xsd:anyType

Result to set, valid only if task state is TaskInfo.State.success
fault*MethodFault

Fault to set, valid only if task state is error. The fault must be a of a fault type that directly or indirectly extends VimFault.
*Need not be set

Return Value

Type Description
None

Faults

Type Description
InvalidStateThrown if attempting to change states after task is completed or in error, or attempting to set the result or fault incorrectly
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition



UpdateProgress

Sets percentage done for this task and recalculates overall percentage done. If a percentDone value of less than zero or greater than 100 is specified, a value of zero or 100 respectively is used.

Required Privileges
Task.Update
Since
VI API 2.5

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the Task used to make the method call.
percentDonexsd:int

Percentage to set for this task

Return Value

Type Description
None

Faults

Type Description
InvalidStateThrown if task is not running
OutOfBoundsVirtualCenter 2.x servers throw this fault if percentDone is less than 0 or greater than 100. Newer versions behave as described above, and never throw this fault.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.

Events

Type
None

Show WSDL type definition