Cluster Compute Resource Place Vm
This method returns a PlacementResult object.
This API can be invoked to ask DRS for a set of recommendations for moving a virtual machine and its virtual disks into a cluster.
Required privileges: System.View
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 ClusterComputeResource/{moId}
.
The vSphere release schema. The current specification covers vSphere 9.0.0.0 APIs.
"PlaceVmRequestType Object"
Specification for placing a virtual machine and its virtual disks
OK
"PlacementResult Object"
The list of recommendations for where to place the virtual machine and its virtual disks.
Information about any fault in case DRS fails to make a recommendation.
InvalidState: if invoked on a DRS disabled cluster.
InvalidArgument: in case of errors in the input "placementSpec". The API can be used for either intra-vCenter migration or cross-vCenter migration, with different requirements for the PlacementSpec. For intra-vCenter migration, the requirements for PlacementSpec are:
- PlacementSpec.vm is required.
- PlacementSpec.relocateSpec can be used to optionally specify the target host, target datastore, or target resource pool for the migration.
- PlacementSpec.hosts can be used to optionally specify a list of compatible hosts for the incoming virtual machine. If this list is empty, all hosts in the cluster will be considered for placement.
- PlacementSpec.datastores can be used to optionally specify a list of compatible datastores for the incoming virtual machine. If this list is empty, all datastores connected to the hosts in the cluster will be considered for placement.
- PlacementSpec.storagePods can be used to optionally specify a list of compatible datastore clusters for the incoming virtual machine. If this list is empty, all datastores connected to the hosts in the cluster will be considered for placement. For cross-vCenter migration, the requirements for PlacementSpec are:
- PlacementSpec.configSpec is required. Within the ConfigSpec, the following elements are required if PlacementSpec.relocateSpec.host is empty: version, cpuAllocation, memoryAllocation, numCPUs, memoryMB; additionally, the following elements of the ConfigSpec are required if PlacementSpec.relocateSpec.datastore is empty: files, swapPlacement, deviceChange.
- PlacementSpec.relocateSpec can be used to optionally specify the target host, target datastore, or target resource pool for the migration.
- PlacementSpec.hosts is required, if PlacementSpec.relocateSpec.host is empty; otherwise, the selected hosts in the PlacementResult are not guaranteed to be compatible with the incoming virtual machine.
- PlacementSpec.datastores is required, if PlacementSpec.relocateSpec.datastore is empty; otherwise, the selected datastores in the PlacementResult are not guaranteed to be compatible with the incoming virtual machine.
"InvalidState Object"
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/ClusterComputeResource/{moId}/PlaceVm