vcenter VM: relocate
Relocates a virtual machine based on the specification. The parts of the virtual machine that can move are: FOLDER, RESOURCE_POOL, HOST, CLUSTER and DATASTORE of home of the virtual machine and disks. . This operation was added in vSphere API 7.0.0.
Request:
HTTP request
POST https://{server}/rest/vcenter/vm/{vm}?action=relocate
Path Parameters
Name | Type | Description |
---|---|---|
Required | ||
vm | string | Existing Virtual machine to relocate. |
Request Body Structure:
{
"spec" : {
"disks" : [
{
"value" : {
"datastore" : "obj-103"
},
"key" : "obj-103"
}
],
"placement" : {
"cluster" : "obj-103",
"folder" : "obj-103",
"datastore" : "obj-103",
"host" : "obj-103",
"resource_pool" : "obj-103"
}
}
}
"spec" : {
"disks" : [
{
"value" : {
"datastore" : "obj-103"
},
"key" : "obj-103"
}
],
"placement" : {
"cluster" : "obj-103",
"folder" : "obj-103",
"datastore" : "obj-103",
"host" : "obj-103",
"resource_pool" : "obj-103"
}
}
}
Request Body Parameters:
Name | Type | Description |
---|---|---|
bold = required | ||
spec | relocate_spec | Relocate specification. |
spec.placement | relocate_placement_spec | Virtual machine placement information. This attribute was added in vSphere API 7.0.0. Optional. If this field is unset, the system will use the values from the source virtual machine. If specified, each field will be used for placement. If the fields result in disjoint placement the operation will fail. If the fields along with the other existing placement of the virtual machine result in disjoint placement the operation will fail. |
spec.placement.folder | string | Virtual machine folder into which the virtual machine should be placed. This attribute was added in vSphere API 7.0.0. Optional. If this field is unset, the virtual machine will stay in the current folder.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Folder . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Folder . |
spec.placement.resource_pool | string | Resource pool into which the virtual machine should be placed. This attribute was added in vSphere API 7.0.0. Optional. If this field is unset, the virtual machine will stay in the current resource pool.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ResourcePool . When operations return a value of this structure as a result, the field will be an identifier for the resource type: ResourcePool . |
spec.placement.host | string | Host onto which the virtual machine should be placed. If If resource_pool is unset, the virtual machine will remain on the current host. if resource_pool is set, and the target is a standalone host, the host is used. if resource_pool is set, and the target is a DRS cluster, a host will be picked by DRS. if resource_pool is set, and the target is a cluster without DRS, InvalidArgument will be thrown.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: HostSystem . When operations return a value of this structure as a result, the field will be an identifier for the resource type: HostSystem . |
spec.placement.cluster | string | Cluster into which the virtual machine should be placed. If If resource_pool or host is specified, it is recommended that this field be unset.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: ClusterComputeResource . When operations return a value of this structure as a result, the field will be an identifier for the resource type: ClusterComputeResource . |
spec.placement.datastore | string | Datastore on which the virtual machine's configuration state should be stored. This datastore will also be used for any virtual disks that are associated with the virtual machine, unless individually overridden. This attribute was added in vSphere API 7.0.0. Optional. If this field is unset, the virtual machine will remain on the current datastore.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Datastore . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Datastore . |
spec.disks | list | Individual disk relocation map. This attribute was added in vSphere API 7.0.0. Optional. If unset, all disks will migrate to the datastore specified in the vcenter.VM.relocate_placement_spec.datastore field of vcenter.VM.relocate_spec.placement.When clients pass a value of this structure as a parameter, the key in the field key/value pairs must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk . When operations return a value of this structure as a result, the key in the field key/value pairs will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk . |
spec.disks[].key | string | |
spec.disks[].value | disk_relocate_spec | |
spec.disks[].value.datastore | string | Destination datastore to relocate disk. This attribute was added in vSphere API 7.0.0. Optional. This field is currently required. In the future, if this field is unset, disk will use the datastore specified in vcenter.VM.relocate_placement_spec.datastore field of vcenter.VM.relocate_spec.placement.When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: Datastore . When operations return a value of this structure as a result, the field will be an identifier for the resource type: Datastore . |
Response:
HTTP Status Code: 200
NoneErrors:
HTTP Status Code | Type | Description |
---|---|---|
500 | error | if the system reports an error while responding to the request. |
400 | invalid_argument | if any of the specified parameters are invalid. |
404 | not_found | if any of the resources specified in spec or the given "vm" could not be found |
500 | resource_inaccessible | if a specified resource (eg. host) is not accessible. |
503 | service_unavailable | if the system is unable to communicate with a service to complete the request. |
401 | unauthenticated | if the user can not be authenticated. |
403 | unauthorized | if the user doesn't have the required privileges. |