Relocate VM operation
This operation enables you to relocate the virtual disks for a virtual machine to a specified location. In addition, you can also use this operation to move a virtual machine to a different datastore or a different host.
The following table describes the elements for this request.
Adapter request elements for the Relocate VM operation
Element | Definition | Required | |
---|---|---|---|
<operation-type> | Defines the type of the operation: Advanced_Vm | Yes | |
<operation-name> | Defines the name of the operation: Relocate_VM | Yes | |
<soap-url> | Specifies the URL for the remote SOAP service running on the VMware VirtualCenter | No | |
<transport> | Specifies the transport protocol for the message | No | |
<user-name> | Specifies the name of the user on the specified host | No | |
<password> | Specifies the password corresponding to <user-name> | Conditional; required if <user-name> is specified | |
<parameters> | Contains the elements required to execute the operation | Yes | |
<virtual-machine> | Specifies the name of the virtual machine that you want to migrate | Yes | |
<datacenter> | Specifies the name of the datacenter hosting the relevant datastore | Conditional; required if the datstore with the same name exists across datacenters | |
<datastore> | Specifies the datastore to which you want to relocate the VM | No | |
<disk-list> | Specifies the datastore location for each virtual disk
| No | |
<datastore> | Specifies the target datastore for the virtual disk | No | |
<disk-name> | Specifies the name of the virtual disk | No | |
<disk-move-type> | Specifies the approach to be used for moving the virtual disk to the target datastore
| No | |
<host-system> | Specifies the DNS name of the target host on which the virtual machine runs | No | |
<transform> | Specifies the transformation to perform on the disks | No |
The following code sample shows a sample adapter request for the Relocate VM operation.
Sample adapter request for the Relocate VM operation
<operation-type>Advanced_Vm</operation-type>
<operation-name>Relocate_VM</operation-name>
<parameters>
<virtual-machine>TestVm</virtual-machine>
<datacenter>Datacenter1</datacenter>
<spec>
<datastore>storage1</datastore>
<disk-move-type>moveChildMostDiskBacking</disk-move-type>
<host-system>ESXHost1</host-system>
<disk-list>
<disk>
<disk-name>Hard disk 1</disk-name>
<datastore>storage2</datastore>
<disk-move-type>moveChildMostDiskBacking</disk-move-type>
</disk>
<disk>
<disk-name>Hard disk 2</disk-name>
<datastore>storage3</datastore>
<disk-move-type>moveChildMostDiskBacking</disk-move-type>
</disk>
</disk-list>
<transform>flat</transform>
</spec>
</parameters>
</vmware-infrastructure-request>
The following code sample shows the response for the sample Relocate VM operation.
Sample adapter response for the Relocate VM operation
<metadata>
<status>success</status>
</metadata>
<RelocateVM_TaskResponse>
<Task>task-53</Task>
</RelocateVM_TaskResponse>
</vmware-infrastructure-response>
The following code sample describes the response element.
Adapter response element for the Relocate VM operation
Element | Definition |
---|---|
<Task> | Specifies the task ID of the submitted task |