REST API - create

vcenter VM: create

Creates a virtual machine.

Request:

HTTP request

POST https://{server}/rest/vcenter/vm

Request Body Structure:

{
    "spec"{
        "cdroms"[
            {
                "start_connected"true,
                "backing"{
                    "device_access_type""EMULATION",
                    "iso_file""string",
                    "type""ISO_FILE",
                    "host_device""string"
                },
                "allow_guest_control"true,
                "ide"{
                    "primary"true,
                    "master"true
                },
                "type""IDE",
                "sata"{
                    "bus"1,
                    "unit"1
                }
            },
            {
                "start_connected"true,
                "backing"{
                    "device_access_type""EMULATION",
                    "iso_file""string",
                    "type""ISO_FILE",
                    "host_device""string"
                },
                "allow_guest_control"true,
                "ide"{
                    "primary"true,
                    "master"true
                },
                "type""IDE",
                "sata"{
                    "bus"1,
                    "unit"1
                }
            }
        ],
        "memory"{
            "size_MiB"1,
            "hot_add_enabled"true
        },
        "disks"[
            {
                "scsi"{
                    "bus"1,
                    "unit"1
                },
                "nvme"{
                    "bus"1,
                    "unit"1
                },
                "new_vmdk"{
                    "name""string",
                    "storage_policy"{
                        "policy""obj-103"
                    },
                    "capacity"1
                },
                "backing"{
                    "vmdk_file""string",
                    "type""VMDK_FILE"
                },
                "ide"{
                    "primary"true,
                    "master"true
                },
                "type""IDE",
                "sata"{
                    "bus"1,
                    "unit"1
                }
            },
            {
                "scsi"{
                    "bus"1,
                    "unit"1
                },
                "nvme"{
                    "bus"1,
                    "unit"1
                },
                "new_vmdk"{
                    "name""string",
                    "storage_policy"{
                        "policy""obj-103"
                    },
                    "capacity"1
                },
                "backing"{
                    "vmdk_file""string",
                    "type""VMDK_FILE"
                },
                "ide"{
                    "primary"true,
                    "master"true
                },
                "type""IDE",
                "sata"{
                    "bus"1,
                    "unit"1
                }
            }
        ],
        "parallel_ports"[
            {
                "start_connected"true,
                "backing"{
                    "file""string",
                    "type""FILE",
                    "host_device""string"
                },
                "allow_guest_control"true
            },
            {
                "start_connected"true,
                "backing"{
                    "file""string",
                    "type""FILE",
                    "host_device""string"
                },
                "allow_guest_control"true
            }
        ],
        "sata_adapters"[
            {
                "bus"1,
                "pci_slot_number"1,
                "type""AHCI"
            },
            {
                "bus"1,
                "pci_slot_number"1,
                "type""AHCI"
            }
        ],
        "cpu"{
            "hot_remove_enabled"true,
            "count"1,
            "hot_add_enabled"true,
            "cores_per_socket"1
        },
        "scsi_adapters"[
            {
                "bus"1,
                "pci_slot_number"1,
                "type""BUSLOGIC",
                "sharing""NONE"
            },
            {
                "bus"1,
                "pci_slot_number"1,
                "type""BUSLOGIC",
                "sharing""NONE"
            }
        ],
        "hardware_version""VMX_03",
        "floppies"[
            {
                "start_connected"true,
                "backing"{
                    "image_file""string",
                    "type""IMAGE_FILE",
                    "host_device""string"
                },
                "allow_guest_control"true
            },
            {
                "start_connected"true,
                "backing"{
                    "image_file""string",
                    "type""IMAGE_FILE",
                    "host_device""string"
                },
                "allow_guest_control"true
            }
        ],
        "nvme_adapters"[
            {
                "bus"1,
                "pci_slot_number"1
            },
            {
                "bus"1,
                "pci_slot_number"1
            }
        ],
        "name""string",
        "nics"[
            {
                "start_connected"true,
                "pci_slot_number"1,
                "backing"{
                    "distributed_port""string",
                    "type""STANDARD_PORTGROUP",
                    "network""obj-103"
                },
                "mac_address""string",
                "mac_type""MANUAL",
                "allow_guest_control"true,
                "wake_on_lan_enabled"true,
                "type""E1000",
                "upt_compatibility_enabled"true
            },
            {
                "start_connected"true,
                "pci_slot_number"1,
                "backing"{
                    "distributed_port""string",
                    "type""STANDARD_PORTGROUP",
                    "network""obj-103"
                },
                "mac_address""string",
                "mac_type""MANUAL",
                "allow_guest_control"true,
                "wake_on_lan_enabled"true,
                "type""E1000",
                "upt_compatibility_enabled"true
            }
        ],
        "storage_policy"{
            "policy""obj-103"
        },
        "placement"{
            "cluster""obj-103",
            "folder""obj-103",
            "datastore""obj-103",
            "host""obj-103",
            "resource_pool""obj-103"
        },
        "boot"{
            "delay"1,
            "efi_legacy_boot"true,
            "retry_delay"1,
            "enter_setup_mode"true,
            "type""BIOS",
            "network_protocol""IPV4",
            "retry"true
        },
        "serial_ports"[
            {
                "start_connected"true,
                "backing"{
                    "proxy""http://myurl.com",
                    "file""string",
                    "pipe""string",
                    "type""FILE",
                    "host_device""string",
                    "no_rx_loss"true,
                    "network_location""http://myurl.com"
                },
                "allow_guest_control"true,
                "yield_on_poll"true
            },
            {
                "start_connected"true,
                "backing"{
                    "proxy""http://myurl.com",
                    "file""string",
                    "pipe""string",
                    "type""FILE",
                    "host_device""string",
                    "no_rx_loss"true,
                    "network_location""http://myurl.com"
                },
                "allow_guest_control"true,
                "yield_on_poll"true
            }
        ],
        "guest_OS""DOS",
        "boot_devices"[
            {
                "type""CDROM"
            },
            {
                "type""CDROM"
            }
        ]
    }
}

Request Body Parameters:

Name Type Description
bold = required
spec create_spec Virtual machine specification.
spec.guest_OS string Guest OS.

Defines the valid guest operating system types used for configuring a virtual machine. Value is one of:
DOS: MS-DOS.
WIN_31: Windows 3.1
WIN_95: Windows 95
WIN_98: Windows 98
WIN_ME: Windows Millennium Edition
WIN_NT: Windows NT 4
WIN_2000_PRO: Windows 2000 Professional
WIN_2000_SERV: Windows 2000 Server
WIN_2000_ADV_SERV: Windows 2000 Advanced Server
WIN_XP_HOME: Windows XP Home Edition
WIN_XP_PRO: Windows XP Professional
WIN_XP_PRO_64: Windows XP Professional Edition (64 bit)
WIN_NET_WEB: Windows Server 2003, Web Edition
WIN_NET_STANDARD: Windows Server 2003, Standard Edition
WIN_NET_ENTERPRISE: Windows Server 2003, Enterprise Edition
WIN_NET_DATACENTER: Windows Server 2003, Datacenter Edition
WIN_NET_BUSINESS: Windows Small Business Server 2003
WIN_NET_STANDARD_64: Windows Server 2003, Standard Edition (64 bit)
WIN_NET_ENTERPRISE_64: Windows Server 2003, Enterprise Edition (64 bit)
WIN_LONGHORN: Windows Longhorn (experimental)
WIN_LONGHORN_64: Windows Longhorn (64 bit) (experimental)
WIN_NET_DATACENTER_64: Windows Server 2003, Datacenter Edition (64 bit) (experimental)
WIN_VISTA: Windows Vista
WIN_VISTA_64: Windows Vista (64 bit)
WINDOWS_7: Windows 7
WINDOWS_7_64: Windows 7 (64 bit)
WINDOWS_7_SERVER_64: Windows Server 2008 R2 (64 bit)
WINDOWS_8: Windows 8
WINDOWS_8_64: Windows 8 (64 bit)
WINDOWS_8_SERVER_64: Windows 8 Server (64 bit)
WINDOWS_9: Windows 10
WINDOWS_9_64: Windows 10 (64 bit)
WINDOWS_9_SERVER_64: Windows 10 Server (64 bit)
WINDOWS_HYPERV: Windows Hyper-V
WINDOWS_SERVER_2019: Windows Server 2019. This constant was added in vSphere API 7.0.0.0.
WINDOWS_SERVER_2021: Windows Server 2021. This constant was added in vSphere API 7.0.1.0.
FREEBSD: FreeBSD 10 or earlier
FREEBSD_64: FreeBSD 10 x64 or earlier
FREEBSD_11: FreeBSD 11. This constant was added in vSphere API 6.7.
FREEBSD_12: FreeBSD 12. This constant was added in vSphere API 6.7.
FREEBSD_13: FreeBSD 13 or later. This constant was added in vSphere API 7.0.1.0.
FREEBSD_11_64: FreeBSD 11 x64. This constant was added in vSphere API 6.7.
FREEBSD_12_64: FreeBSD 12 x64. This constant was added in vSphere API 6.7.
FREEBSD_13_64: FreeBSD 13 x64 or later. This constant was added in vSphere API 7.0.1.0.
REDHAT: Red Hat Linux 2.1
RHEL_2: Red Hat Enterprise Linux 2
RHEL_3: Red Hat Enterprise Linux 3
RHEL_3_64: Red Hat Enterprise Linux 3 (64 bit)
RHEL_4: Red Hat Enterprise Linux 4
RHEL_4_64: Red Hat Enterprise Linux 4 (64 bit)
RHEL_5: Red Hat Enterprise Linux 5
RHEL_5_64: Red Hat Enterprise Linux 5 (64 bit) (experimental)
RHEL_6: Red Hat Enterprise Linux 6
RHEL_6_64: Red Hat Enterprise Linux 6 (64 bit)
RHEL_7: Red Hat Enterprise Linux 7
RHEL_7_64: Red Hat Enterprise Linux 7 (64 bit)
RHEL_8_64: Red Hat Enterprise Linux 8 (64 bit). This constant was added in vSphere API 6.7.
RHEL_9_64: Red Hat Enterprise Linux 9 (64 bit). This constant was added in vSphere API 7.0.1.0.
CENTOS: CentOS 4/5
CENTOS_64: CentOS 4/5 (64-bit)
CENTOS_6: CentOS 6
CENTOS_6_64: CentOS 6 (64-bit)
CENTOS_7: CentOS 7
CENTOS_7_64: CentOS 7 (64-bit)
CENTOS_8_64: CentOS 8 (64-bit). This constant was added in vSphere API 6.7.
CENTOS_9_64: CentOS 9 (64-bit). This constant was added in vSphere API 7.0.1.0.
ORACLE_LINUX: Oracle Linux 4/5
ORACLE_LINUX_64: Oracle Linux 4/5 (64-bit)
ORACLE_LINUX_6: Oracle Linux 6
ORACLE_LINUX_6_64: Oracle Linux 6 (64-bit)
ORACLE_LINUX_7: Oracle Linux 7
ORACLE_LINUX_7_64: Oracle Linux 7 (64-bit)
ORACLE_LINUX_8_64: Oracle Linux 8 (64-bit). This constant was added in vSphere API 6.7.
ORACLE_LINUX_9_64: Oracle Linux 9 (64-bit). This constant was added in vSphere API 7.0.1.0.
SUSE: Suse Linux
SUSE_64: Suse Linux (64 bit)
SLES: Suse Linux Enterprise Server 9
SLES_64: Suse Linux Enterprise Server 9 (64 bit)
SLES_10: Suse linux Enterprise Server 10
SLES_10_64: Suse Linux Enterprise Server 10 (64 bit) (experimental)
SLES_11: Suse linux Enterprise Server 11
SLES_11_64: Suse Linux Enterprise Server 11 (64 bit)
SLES_12: Suse linux Enterprise Server 12
SLES_12_64: Suse Linux Enterprise Server 12 (64 bit)
SLES_15_64: Suse Linux Enterprise Server 15 (64 bit). This constant was added in vSphere API 6.7.
SLES_16_64: Suse Linux Enterprise Server 16 (64 bit). This constant was added in vSphere API 7.0.1.0.
NLD_9: Novell Linux Desktop 9
OES: Open Enterprise Server
SJDS: Sun Java Desktop System
MANDRAKE: Mandrake Linux
MANDRIVA: Mandriva Linux
MANDRIVA_64: Mandriva Linux (64 bit)
TURBO_LINUX: Turbolinux
TURBO_LINUX_64: Turbolinux (64 bit)
UBUNTU: Ubuntu Linux
UBUNTU_64: Ubuntu Linux (64 bit)
DEBIAN_4: Debian GNU/Linux 4
DEBIAN_4_64: Debian GNU/Linux 4 (64 bit)
DEBIAN_5: Debian GNU/Linux 5
DEBIAN_5_64: Debian GNU/Linux 5 (64 bit)
DEBIAN_6: Debian GNU/Linux 6
DEBIAN_6_64: Debian GNU/Linux 6 (64 bit)
DEBIAN_7: Debian GNU/Linux 7
DEBIAN_7_64: Debian GNU/Linux 7 (64 bit)
DEBIAN_8: Debian GNU/Linux 8
DEBIAN_8_64: Debian GNU/Linux 8 (64 bit)
DEBIAN_9: Debian GNU/Linux 9
DEBIAN_9_64: Debian GNU/Linux 9 (64 bit)
DEBIAN_10: Debian GNU/Linux 10
DEBIAN_10_64: Debian GNU/Linux 10 (64 bit)
DEBIAN_11: Debian GNU/Linux 11. This constant was added in vSphere API 7.0.0.0.
DEBIAN_11_64: Debian GNU/Linux 11 (64 bit). This constant was added in vSphere API 7.0.0.0.
ASIANUX_3: Asianux Server 3
ASIANUX_3_64: Asianux Server 3 (64 bit)
ASIANUX_4: Asianux Server 4
ASIANUX_4_64: Asianux Server 4 (64 bit)
ASIANUX_5_64: Asianux Server 5 (64 bit)
ASIANUX_7_64: Asianux Server 7 (64 bit)
ASIANUX_8_64: Asianux Server 8 (64 bit). This constant was added in vSphere API 6.7.
ASIANUX_9_64: Asianux Server 9 (64 bit). This constant was added in vSphere API 7.0.1.0.
OPENSUSE: OpenSUSE Linux
OPENSUSE_64: OpenSUSE Linux (64 bit)
FEDORA: Fedora Linux
FEDORA_64: Fedora Linux (64 bit)
COREOS_64: CoreOS Linux (64 bit)
VMWARE_PHOTON_64: VMware Photon (64 bit)
OTHER_24X_LINUX: Linux 2.4x Kernel
OTHER_24X_LINUX_64: Linux 2.4x Kernel (64 bit) (experimental)
OTHER_26X_LINUX: Linux 2.6x Kernel
OTHER_26X_LINUX_64: Linux 2.6x Kernel (64 bit) (experimental)
OTHER_3X_LINUX: Linux 3.x Kernel
OTHER_3X_LINUX_64: Linux 3.x Kernel (64 bit)
OTHER_4X_LINUX: Linux 4.x Kernel. This constant was added in vSphere API 6.7.
OTHER_4X_LINUX_64: Linux 4.x Kernel (64 bit). This constant was added in vSphere API 6.7.
OTHER_5X_LINUX: Linux 5.x Kernel. This constant was added in vSphere API 7.0.1.0.
OTHER_5X_LINUX_64: Linux 5.x Kernel (64 bit). This constant was added in vSphere API 7.0.1.0.
OTHER_LINUX: Linux 2.2x Kernel
GENERIC_LINUX: Other Linux
OTHER_LINUX_64: Linux (64 bit) (experimental)
SOLARIS_6: Solaris 6
SOLARIS_7: Solaris 7
SOLARIS_8: Solaris 8
SOLARIS_9: Solaris 9
SOLARIS_10: Solaris 10 (32 bit) (experimental)
SOLARIS_10_64: Solaris 10 (64 bit) (experimental)
SOLARIS_11_64: Solaris 11 (64 bit)
OS2: OS/2
ECOMSTATION: eComStation 1.x
ECOMSTATION_2: eComStation 2.0
NETWARE_4: Novell NetWare 4
NETWARE_5: Novell NetWare 5.1
NETWARE_6: Novell NetWare 6.x
OPENSERVER_5: SCO OpenServer 5
OPENSERVER_6: SCO OpenServer 6
UNIXWARE_7: SCO UnixWare 7
DARWIN: Mac OS 10.5
DARWIN_64: Mac OS 10.5 (64 bit)
DARWIN_10: Mac OS 10.6
DARWIN_10_64: Mac OS 10.6 (64 bit)
DARWIN_11: Mac OS 10.7
DARWIN_11_64: Mac OS 10.7 (64 bit)
DARWIN_12_64: Mac OS 10.8 (64 bit)
DARWIN_13_64: Mac OS 10.9 (64 bit)
DARWIN_14_64: Mac OS 10.10 (64 bit)
DARWIN_15_64: Mac OS 10.11 (64 bit)
DARWIN_16_64: Mac OS 10.12 (64 bit)
DARWIN_17_64: Mac OS 10.13 (64 bit). This constant was added in vSphere API 6.7.
DARWIN_18_64: Mac OS 10.14 (64 bit). This constant was added in vSphere API 6.7.
DARWIN_19_64: Mac OS 10.15 (64 bit). This constant was added in vSphere API 7.0.0.0.
DARWIN_20_64: Mac OS 10.16 (64 bit). This constant was added in vSphere API 7.0.1.0.
DARWIN_21_64: Mac OS 10.17 (64 bit). This constant was added in vSphere API 7.0.1.0.
VMKERNEL: VMware ESX 4
VMKERNEL_5: VMware ESX 5
VMKERNEL_6: VMware ESX 6
VMKERNEL_65: VMware ESX 6.5
VMKERNEL_7: VMware ESX 7. This constant was added in vSphere API 7.0.0.0.
AMAZONLINUX2_64: Amazon Linux 2 (64 bit). This constant was added in vSphere API 6.7.1.
AMAZONLINUX3_64: Amazon Linux 3 (64 bit). This constant was added in vSphere API 7.0.1.0.
CRXPOD_1: CRX Pod 1. This constant was added in vSphere API 7.0.0.0.
OTHER: Other Operating System
OTHER_64: Other Operating System (64 bit) (experimental)

spec.name string Virtual machine name.

Optional. If unset, a default name will be generated by the server.

spec.placement placement_spec Virtual machine placement information.

Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose suitable resources on which to place the virtual machine.

spec.placement.folder string Virtual machine folder into which the virtual machine should be placed.

Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose a suitable folder for the virtual machine; if a folder cannot be chosen, the virtual machine creation operation will fail.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.

Optional. This field is currently required if both host and cluster are unset. In the future, if this field is unset, the system will attempt to choose a suitable resource pool for the virtual machine; if a resource pool cannot be chosen, the virtual machine creation operation will fail.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 host and resource_pool are both specified, resource_pool must belong to host.

If host and cluster are both specified, host must be a member of cluster.

Optional. This field may be unset if resource_pool or cluster is specified. If unset, the system will attempt to choose a suitable host for the virtual machine; if a host cannot be chosen, the virtual machine creation operation will fail.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 cluster and resource_pool are both specified, resource_pool must belong to cluster.

If cluster and host are both specified, host must be a member of cluster.

Optional. 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 created as part of the virtual machine creation operation.

Optional. This field is currently required. In the future, if this field is unset, the system will attempt to choose suitable storage for the virtual machine; if storage cannot be chosen, the virtual machine creation operation will fail.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.hardware_version string Virtual hardware version.

Optional. If unset, defaults to the most recent version supported by the server.

spec.boot create_spec Boot configuration.

Optional. If unset, guest-specific default values will be used.

spec.boot.type string Firmware type to be used by the virtual machine.

Optional. If unset, defaults to value that is recommended for the guest OS and is supported for the virtual hardware version.

spec.boot.efi_legacy_boot boolean Flag indicating whether to use EFI legacy boot mode.

Optional. It is only relevant when type has value EFI. If unset, defaults to value that is recommended for the guest OS and is supported for the virtual hardware version.

spec.boot.network_protocol string Protocol to use when attempting to boot the virtual machine over the network.

Optional. It is only relevant when type has value EFI. If unset, defaults to a system defined default value.

spec.boot.delay long Delay in milliseconds before beginning the firmware boot process when the virtual machine is powered on. This delay may be used to provide a time window for users to connect to the virtual machine console and enter BIOS setup mode.

Optional. If unset, default value is 0.

spec.boot.retry boolean Flag indicating whether the virtual machine should automatically retry the boot process after a failure.

Optional. If unset, default value is false.

spec.boot.retry_delay long Delay in milliseconds before retrying the boot process after a failure; applicable only when vcenter.vm.hardware.boot.info.retry is true.

Optional. If unset, default value is 10000.

spec.boot.enter_setup_mode boolean Flag indicating whether the firmware boot process should automatically enter setup mode the next time the virtual machine boots. Note that this flag will automatically be reset to false once the virtual machine enters setup mode.

Optional. If unset, the value is unchanged.

spec.boot_devices entry_create_spec[] Boot device configuration.

Optional. If unset, a server-specific boot sequence will be used.

spec.boot_devices[].type string Virtual Boot device type.

Defines the valid device types that may be used as bootable devices. Value is one of:
CDROM: Virtual CD-ROM device.
DISK: Virtual disk device.
ETHERNET: Virtual Ethernet adapter.
FLOPPY: Virtual floppy drive.

spec.cpu update_spec CPU configuration.

Optional. If unset, guest-specific default values will be used.

spec.cpu.count long New number of CPU cores. The number of CPU cores in the virtual machine must be a multiple of the number of cores per socket.

The supported range of CPU counts is constrained by the configured guest operating system and virtual hardware version of the virtual machine.

If the virtual machine is running, the number of CPU cores may only be increased if vcenter.vm.hardware.cpu.info.hot_add_enabled is true, and may only be decreased if vcenter.vm.hardware.cpu.info.hot_remove_enabled is true.

Optional. If unset, the value is unchanged.

spec.cpu.cores_per_socket long New number of CPU cores per socket. The number of CPU cores in the virtual machine must be a multiple of the number of cores per socket.

Optional. If unset, the value is unchanged.

spec.cpu.hot_add_enabled boolean Flag indicating whether adding CPUs while the virtual machine is running is enabled.

This field may only be modified if the virtual machine is powered off.

Optional. If unset, the value is unchanged.

spec.cpu.hot_remove_enabled boolean Flag indicating whether removing CPUs while the virtual machine is running is enabled.

This field may only be modified if the virtual machine is powered off.

Optional. If unset, the value is unchanged.

spec.memory update_spec Memory configuration.

Optional. If unset, guest-specific default values will be used.

spec.memory.size_MiB long New memory size in mebibytes.

The supported range of memory sizes is constrained by the configured guest operating system and virtual hardware version of the virtual machine.

If the virtual machine is running, this value may only be changed if vcenter.vm.hardware.memory.info.hot_add_enabled is true, and the new memory size must satisfy the constraints specified by vcenter.vm.hardware.memory.info.hot_add_increment_size_MiB and vcenter.vm.hardware.memory.info.hot_add_limit_MiB.

Optional. If unset, the value is unchanged.

spec.memory.hot_add_enabled boolean Flag indicating whether adding memory while the virtual machine is running should be enabled.

Some guest operating systems may consume more resources or perform less efficiently when they run on hardware that supports adding memory while the machine is running.

This field may only be modified if the virtual machine is not powered on.

Optional. If unset, the value is unchanged.

spec.disks create_spec[] List of disks.

Optional. If unset, 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.

spec.disks[].type string Type of host bus adapter to which the device should be attached.

Optional. If unset, guest-specific default values will be used.

spec.disks[].ide ide_address_spec Address for attaching the device to a virtual IDE adapter.

Optional. It is only relevant when type has value IDE. If unset, the server will choose an available address; if none is available, the request will fail.

spec.disks[].ide.primary boolean Flag specifying whether the device should be attached to the primary or secondary IDE adapter of the virtual machine.

Optional. If unset, the server will choose a adapter with an available connection. If no IDE connections are available, the request will be rejected.

spec.disks[].ide.master boolean Flag specifying whether the device should be the master or slave device on the IDE adapter.

Optional. If unset, the server will choose an available connection type. If no IDE connections are available, the request will be rejected.

spec.disks[].scsi scsi_address_spec Address for attaching the device to a virtual SCSI adapter.

Optional. It is only relevant when type has value SCSI. If unset, the server will choose an available address; if none is available, the request will fail.

spec.disks[].scsi.bus long Bus number of the adapter to which the device should be attached.

spec.disks[].scsi.unit long Unit number of the device.

Optional. If unset, the server will choose an available unit number on the specified adapter. If there are no available connections on the adapter, the request will be rejected.

spec.disks[].sata sata_address_spec Address for attaching the device to a virtual SATA adapter.

Optional. It is only relevant when type has value SATA. If unset, the server will choose an available address; if none is available, the request will fail.

spec.disks[].sata.bus long Bus number of the adapter to which the device should be attached.

spec.disks[].sata.unit long Unit number of the device.

Optional. If unset, the server will choose an available unit number on the specified adapter. If there are no available connections on the adapter, the request will be rejected.

spec.disks[].nvme nvme_address_spec Address for attaching the device to a virtual NVMe adapter. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented.

Optional. It is only relevant when type has value NVME. If unset, the server will choose an available address; if none is available, the request will fail.

spec.disks[].nvme.bus long Bus number of the adapter to which the device should be attached. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented.

spec.disks[].nvme.unit long Unit number of the device. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented.

Optional. If unset, the server will choose an available unit number on the specified adapter. If there are no available connections on the adapter, the request will be rejected.

spec.disks[].backing backing_spec Existing physical resource backing for the virtual disk. Exactly one of backing or new_vmdk must be specified.

Optional. If unset, the virtual disk will not be connected to an existing backing.

spec.disks[].backing.type string Backing type for the virtual disk.

Defines the valid backing types for a virtual disk. Value is one of:
VMDK_FILE: Virtual disk is backed by a VMDK file.

spec.disks[].backing.vmdk_file string Path of the VMDK file backing the virtual disk.

Optional. It is only relevant when type has value VMDK_FILE. This field is optional and it is only relevant when the value of type is VMDK_FILE.

spec.disks[].new_vmdk vmdk_create_spec Specification for creating a new VMDK backing for the virtual disk. Exactly one of backing or new_vmdk must be specified.

Optional. If unset, a new VMDK backing will not be created.

spec.disks[].new_vmdk.name string Base name of the VMDK file. The name should not include the '.vmdk' file extension.

Optional. If unset, a name (derived from the name of the virtual machine) will be chosen by the server.

spec.nics create_spec[] List of Ethernet adapters.

Optional. If unset, no Ethernet adapters will be created.

spec.cdroms create_spec[] List of CD-ROMs.

Optional. If unset, no CD-ROM devices will be created.

spec.floppies create_spec[] List of floppy drives.

Optional. If unset, no floppy drives will be created.

spec.parallel_ports create_spec[] List of parallel ports.

Optional. If unset, no parallel ports will be created.

spec.serial_ports create_spec[] List of serial ports.

Optional. If unset, no serial ports will be created.

spec.sata_adapters create_spec[] List of SATA adapters.

Optional. If unset, 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.

spec.scsi_adapters create_spec[] List of SCSI adapters.

Optional. If unset, 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.

spec.nvme_adapters create_spec[] List of NVMe adapters. Warning: This attribute is part of a new feature in development. It may be changed at any time and may not have all supported functionality implemented.

Optional. If unset, 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.

spec.storage_policy storage_policy_spec The storage_policy_spec structure contains information about the storage policy that is to be associated with the virtual machine home (which contains the configuration and log files). This attribute was added in vSphere API 6.7.

Optional. If unset 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 unset then no storage policy would be associated with the virtual machine home.

spec.storage_policy.policy string Identifier of the storage policy which should be associated with the virtual machine. This attribute was added in vSphere API 6.7.

When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.vcenter.StoragePolicy. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.vcenter.StoragePolicy.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string ID of newly-created virtual machine.

Errors:

HTTP Status Code Type Description
400 already_exists if a virtual machine with the specified name already exists.
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 could not be found
500 resource_inaccessible if a specified resource (eg. host) is not accessible.
400 resource_in_use if any of the specified storage addresses (eg. IDE, SATA, SCSI, NVMe) result in a storage address conflict.
503 service_unavailable if the system is unable to communicate with a service to complete the request.
500 unable_to_allocate_resource if any of the resources needed to create the virtual machine could not be allocated.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user doesn't have the required privileges.
400 unsupported if guest_OS is not supported for the requested virtual hardware version and spec includes unset fields that default to guest-specific values.