Resource Pool Create Child VM Task
Creates a new virtual machine in a vApp container.
This method supports creating a virtual machine directly in a vApp. A virtual machine in a vApp is not associated with a VM folder and therefore cannot be created using the method on a Folder.
This method can only be called directly on a vApp or on a resource pool that is a child of a vApp.
The privilege VirtualMachine.Inventory.Create is required on this entity. Further, if this is a resource pool, the privilege Resource.AssignVMToPool is required. If this is a vApp, the privilege VApp.AssignVM is required.
Depending on the properties of the virtual machine bring created, additional privileges may be required. See CreateVM_Task for a description of these privileges.
Required privileges: VirtualMachine.Inventory.Create
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 ResourcePool/{moId}
.
The vSphere release schema. The current specification covers vSphere 9.0.0.0 APIs.
"CreateChildVMRequestType Object"
The configuration of the virtual machine hardware.
The target host on which the virtual machine will run. This must specify a host that is a member of the ComputeResource indirectly specified by the pool. For a stand-alone host or a cluster with DRS, host can be omitted, and the system selects a default.
This method returns a Task object with which to monitor the operation. The info.result property in the Task contains the newly created VirtualMachine upon success.
"MoRefTask Object"
VmConfigFault: if the configSpec has incorrect values. Typically, a more specific subclass is thrown.
OutOfBounds: if Host.capability.maxSupportedVMs is exceeded.
FileAlreadyExists: if the requested cfgPath for the virtual machine's configuration file already exists.
FileFault: if there is a problem creating the virtual machine on disk. Typically, a more specific subclass, such as NoDiskSpace, will be thrown.
InvalidName: if the name is not a valid entity name.
InsufficientResourcesFault: if this operation would violate a resource usage policy.
InvalidDatastore: if the operation cannot be performed on the target datastores.
VmWwnConflict: if the WWN of the virtual machine has been used by other virtual machines.
NotSupported: if this resource pool is not a vApp or is a child of a vApp.
"VimFault Object"
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/ResourcePool/{moId}/CreateChildVM_Task