Vcenter VM create
Creates a virtual machine.
Returns an authorization error if you do not have all of the privileges described as follows:
- The resource
Folder
referenced by the property Vcenter VM InventoryPlacementSpec.folder requiresVirtualMachine.Inventory.Create
. - The resource
ResourcePool
referenced by the property Vcenter VM ComputePlacementSpec.resource_pool requiresResource.AssignVMToPool
. - The resource
Datastore
referenced by the property Vcenter VM StoragePlacementSpec.datastore requiresDatastore.AllocateSpace
. - The resource
Network
referenced by the property Vcenter Vm Hardware Ethernet BackingSpec.network requiresNetwork.Assign
.
Virtual machine specification.
Show optional properties
{
"guest_os": "string"
}
{
"guest_os": "string",
"name": "string",
"placement": {
"folder": "string",
"resource_pool": "string",
"host": "string",
"cluster": "string",
"datastore": "string"
},
"hardware_version": "string",
"boot": {
"type": "string",
"efi_legacy_boot": false,
"network_protocol": "string",
"delay": 0,
"retry": false,
"retry_delay": 0,
"enter_setup_mode": false
},
"boot_devices": [
{
"type": "string"
}
],
"cpu": {
"count": 0,
"cores_per_socket": 0,
"hot_add_enabled": false,
"hot_remove_enabled": false
},
"memory": {
"size_mib": 0,
"hot_add_enabled": false
},
"disks": [
{
"type": "string",
"ide": {
"primary": false,
"master": false
},
"scsi": {
"bus": 0,
"unit": 0
},
"sata": {
"bus": 0,
"unit": 0
},
"nvme": {
"bus": 0,
"unit": 0
},
"backing": {
"type": "string",
"vmdk_file": "string"
},
"new_vmdk": {
"name": "string",
"capacity": 0,
"storage_policy": {
"policy": "string"
}
}
}
],
"nics": [
{
"type": "string",
"upt_compatibility_enabled": false,
"upt_v2_compatibility_enabled": false,
"mac_type": "string",
"mac_address": "string",
"pci_slot_number": 0,
"wake_on_lan_enabled": false,
"backing": {
"type": "string",
"network": "string",
"distributed_port": "string"
},
"start_connected": false,
"allow_guest_control": false
}
],
"cdroms": [
{
"type": "string",
"ide": {
"primary": false,
"master": false
},
"sata": {
"bus": 0,
"unit": 0
},
"backing": {
"type": "string",
"iso_file": "string",
"host_device": "string",
"device_access_type": "string"
},
"start_connected": false,
"allow_guest_control": false
}
],
"floppies": [
{
"backing": {
"type": "string",
"image_file": "string",
"host_device": "string"
},
"start_connected": false,
"allow_guest_control": false
}
],
"parallel_ports": [
{
"backing": {
"type": "string",
"file": "string",
"host_device": "string"
},
"start_connected": false,
"allow_guest_control": false
}
],
"serial_ports": [
{
"yield_on_poll": false,
"backing": {
"type": "string",
"file": "string",
"host_device": "string",
"pipe": "string",
"no_rx_loss": false,
"network_location": "string",
"proxy": "string"
},
"start_connected": false,
"allow_guest_control": false
}
],
"sata_adapters": [
{
"type": "string",
"bus": 0,
"pci_slot_number": 0
}
],
"scsi_adapters": [
{
"type": "string",
"bus": 0,
"pci_slot_number": 0,
"sharing": "string"
}
],
"nvme_adapters": [
{
"bus": 0,
"pci_slot_number": 0
}
],
"storage_policy": {
"policy": "string"
}
}
Guest OS.
For more information see: Vcenter Vm GuestOS.
Virtual machine name.
If missing or null
, a default name will be generated by the server.
Virtual machine placement information.
This property is currently required. In the future, if this property is missing or null
, the system will attempt to choose suitable resources on which to place the virtual machine.
Virtual hardware version.
For more information see: Vcenter Vm Hardware Version.
If missing or null
, defaults to the most recent version supported by the server.
Boot configuration.
If missing or null
, guest-specific default values will be used.
Boot device configuration.
If missing or null
, a server-specific boot sequence will be used.
CPU configuration.
If missing or null
, guest-specific default values will be used.
Memory configuration.
If missing or null
, guest-specific default values will be used.
List of disks.
If missing or null
, a single blank virtual disk of a guest-specific size will be created on the same storage as the virtual machine configuration, and will use a guest-specific host bus adapter type. If the guest-specific size is 0, no virtual disk will be created.
List of Ethernet adapters.
If missing or null
, no Ethernet adapters will be created.
List of CD-ROMs.
If missing or null
, no CD-ROM devices will be created.
List of floppy drives.
If missing or null
, no floppy drives will be created.
List of parallel ports.
If missing or null
, no parallel ports will be created.
List of serial ports.
If missing or null
, no serial ports will be created.
List of SATA adapters.
If missing or null
, any adapters necessary to connect the virtual machine's storage devices will be created; this includes any devices that explicitly specify a SATA host bus adapter, as well as any devices that do not specify a host bus adapter if the guest's preferred adapter type is SATA.
List of SCSI adapters.
If missing or null
, any adapters necessary to connect the virtual machine's storage devices will be created; this includes any devices that explicitly specify a SCSI host bus adapter, as well as any devices that do not specify a host bus adapter if the guest's preferred adapter type is SCSI. The type of the SCSI adapter will be a guest-specific default type.
List of NVMe adapters.
This property was added in vSphere API 7.0.0.1.
If missing or null
, any adapters necessary to connect the virtual machine's storage devices will be created; this includes any devices that explicitly specify a NVMe host bus adapter, as well as any devices that do not specify a host bus adapter if the guest's preferred adapter type is NVMe.
The Vcenter VM StoragePolicySpec schema contains information about the storage policy that is to be associated with the virtual machine home (which contains the configuration and log files).
This property was added in vSphere API 6.7.
If missing or null
the datastore default storage policy (if applicable) is applied. Currently a default storage policy is only supported by object datastores : VVol and vSAN. For non-object datastores, if missing or null
then no storage policy would be associated with the virtual machine home.
ID of newly-created virtual machine.
The response will be an identifier for the resource type: VirtualMachine
.
Vapi Std Errors AlreadyExists if a virtual machine with the specified name already exists.
Vapi Std Errors InvalidArgument if any of the specified parameters are invalid.
Vapi Std Errors ResourceInUse if any of the specified storage addresses (eg. IDE, SATA, SCSI, NVMe) result in a storage address conflict.
Vapi Std Errors Unsupported if guest_OS is not supported for the requested virtual hardware version and spec includes missing or null
properties that default to guest-specific values.
"Vapi Std Errors Error Object"
Stack of one or more localizable messages for human error consumers.
The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.
Each subsequent message in the stack describes the "cause" of the prior message.
Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.
Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.
The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.
Some operations will not set this property when reporting errors.
Discriminator field to help API consumers identify the structure type.
For more information see: Vapi Std Errors Error Type.
This property was added in vSphere API 6.7.2.
Can be missing or null
for compatibility with preceding implementations.
if the user can not be authenticated.
"Vapi Std Errors Unauthenticated Object"
Indicates the authentication challenges applicable to the target API provider. It can be used by a client to discover the correct authentication scheme to use. The exact syntax of the value is defined by the specific provider, the protocol and authentication schemes used.
For example, a provider using REST may adhere to the WWW-Authenticate HTTP header specification, RFC7235, section 4.1. In this case an example challenge value may be: SIGN realm="27da1358-2ba4-11e9-b210-d663bd873d93",sts="http://vcenter/sso?vsphere.local", Basic realm="vCenter"
This property was added in vSphere API 7.0.0.0.
This property is optional because it was added in a newer version than its parent node.
if the user doesn't have the required privileges.
"Vapi Std Errors Unauthorized Object"
if any of the resources specified in spec could not be found
"Vapi Std Errors NotFound Object"
Vapi Std Errors Error if the system reports an error while responding to the request.
Vapi Std Errors ResourceInaccessible if a specified resource (eg. host) is not accessible.
Vapi Std Errors UnableToAllocateResource if any of the resources needed to create the virtual machine could not be allocated.
"Vapi Std Errors Error Object"
Stack of one or more localizable messages for human error consumers.
The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.
Each subsequent message in the stack describes the "cause" of the prior message.
Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.
Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.
The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.
Some operations will not set this property when reporting errors.
Discriminator field to help API consumers identify the structure type.
For more information see: Vapi Std Errors Error Type.
This property was added in vSphere API 6.7.2.
Can be missing or null
for compatibility with preceding implementations.
if the system is unable to communicate with a service to complete the request.
"Vapi Std Errors ServiceUnavailable Object"
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"guest_os:"string"}' https://{api_host}/api/vcenter/vm