Virtual Machine Migrate VM Task
Deprecated as of vSphere 6.5, use RelocateVM_Task instead.
Migrates a virtual machine's execution to a specific resource pool or host.
Requires Resource.HotMigrate privilege if the virtual machine is powered on or Resource.ColdMigrate privilege if the virtual machine is powered off or suspended.
The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId
, in this case VirtualMachine/{moId}
.
The vSphere release schema. The current specification covers vSphere 9.0.0.0 APIs.
"MigrateVMRequestType Object"
The target resource pool for the virtual machine. If the pool parameter is left unset, the virtual machine's current pool is used as the target pool.
Required privileges: Resource.AssignVMToPool
The target host to which the virtual machine is intended to migrate. The host parameter may be left unset if the compute resource associated with the target pool represents a stand-alone host or a DRS-enabled cluster. In the former case the stand-alone host is used as the target host. In the latter case, the DRS system selects an appropriate target host from the cluster.
The task priority (@see vim.VirtualMachine.MovePriority).
If specified, the virtual machine migrates only if its state matches the specified state.
This method returns a Task object with which to monitor the operation.
"MoRefTask Object"
NotSupported: if the virtual machine is marked as a template.
InvalidArgument: in the following cases:
- the target host and target pool are not associated with the same compute resource
- the host parameter is left unset when the target pool is associated with a non-DRS cluster
InvalidPowerState: if the state argument is set and the virtual machine does not have that power state.
FileFault: if, in a case where the virtual machine configuration file must be copied, the destination location for that file does not have the necessary file access permissions.
VmConfigFault: if the virtual machine is not compatible with the destination host. Typically, a specific subclass of this exception is thrown, such as IDEDiskNotSupported.
MigrationFault: if it is not possible to migrate the virtual machine to the destination host. This is typically due to hosts being incompatible, such as mismatch in network polices or access to networks and datastores. Typically, a more specific subclass is thrown.
Timedout: if one of the phases of the migration process times out.
InsufficientResourcesFault: if this operation would violate a resource usage policy.
InvalidState: if the operation cannot be performed because of the virtual machine's current state or the target host's current state. For example, if the virtual machine configuration information is not available or if the target host is disconnected or in maintenance mode.
NoActiveHostInCluster: if a target host is not specified and the cluster associated with the target pool does not contain at least one potential target host. A host must be connected and not in maintenance mode in order to be considered as a potential target host.
NoPermission: if the virtual machine is encrypted, but encryption is not enabled on the destination host and the user does not have Cryptographer.RegisterHost permission on it.
NoPermission: if the virtual machine is encrypted, but the the user does not have Cryptographer.Migrate permission on the VM.
"VimFault Object"
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/VirtualMachine/{moId}/MigrateVM_Task