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

If the <soap-url> element is not specified, the request uses the VirtualCenter Server details specified in the adapter configuration.

Default format for HTTPS: https://<hostName>:<port>/sdk/vim

Default format for HTTP: http://<hostName>:<port>/sdk/vim

Note

If you want to use an HTTP value, you might need to change the configuration of the VMware Infrastructure application.

No

<transport>

Specifies the transport protocol for the message

If the transport element is not provided, the request uses the VirtualCenter Server details specified in the adapter configuration.

Valid values: https-rpc (default), http-rpc

Note

If the value of the <transport> element is https-rpc, you must install the security certificate for the VMware Virtual Center to the keystore of the peer on which the adapter is enabled.

No

<user-name>

Specifies the name of the user on the specified host

You must specify this element only if the proxy server requires this authentication.

If no user name is specified, the request is executed with the user name that is specified in the configuration.

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
Valid value: Any string

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
By default, the VM is relocated to the same datastore.

No

<disk-list>

Specifies the datastore location for each virtual disk

XML sample

<disk-list>
  <disk>
    <datastore></datastore>
    <disk-name></disk-name>
    <disk-move-type></disk-move-type>
  <disk>
  <disk>
    <datastore></datastore>
    <disk-name></disk-name>
    <disk-move-type></disk-move-type>
  </disk>
</disk-list>

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

Valid values:

  • createNewChildDiskBacking: Create a new child disk backing on the destination datastore. The existing files on the virtual disk are not moved from their current location.
  • moveAllDiskBackingsAndAllowSharing: All the backings for the virtual disk are moved to the new datastore. If a disk backing is not the child-most backing of this virtual machine, and there exists a read-only disk backing with the same content ID on the target datastore, this disk backing is not copied. Instead, it is acceptable to attach to the read-only disk backing at the target datastore. A read-only disk backing is defined as a virtual disk backing.
  • moveAllDiskBackingsAndDisallowSharing: All backings for the virtual disk is moved to the new datastore. It is not acceptable to attach to a disk backing with the same content ID on the destination datastore.
  • moveChildMostDiskBacking: Move only the child-most disk backing. Any parent disk backings are left in their current location. This option only differs from moveAllDiskBackingsAndAllowSharing and moveAllDiskBackingsAndDisallowSharing when the virtual disk has a parent backing.

    This property applies to all the disks which the virtual machine has, but can be overridden on a per-disk basis using diskMoveType.
    This property can only be set if deltaDiskBackingsSupported is true at HostSystem level. By default, the adapter uses moveAllDiskBackingsAndDisallowSharing.
    The disk-move-type element is supported only in VMware vSphere 4.0.

No

<host-system>

Specifies the DNS name of the target host on which the virtual machine runs

Valid value: host name

If the compute resource associated with the target pool represents a stand-alone host or a DRS-enabled cluster, the host parameter is not specified. For a stand-alone host, the host is used as the target host. For a DRS-enabled cluster, every connected host in the cluster that is not in maintenance mode is tested as a target host.

No

<transform>

Specifies the transformation to perform on the disks
If the transformation is not valid for the current operation, the value specified in this element is . This element can be used to create sparse disks for templates.
Valid values: flat, sparse

No

The following code sample shows a sample adapter request for the Relocate VM operation.

Sample adapter request for the Relocate VM operation

<vmware-infrastructure-request>
 <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

<vmware-infrastructure-response>
 <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

Use the task ID to obtain the status of the specified task.

For information about using the task ID to check the task status, see Request and response for the Retrieve_Task_Status operation.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*