Create Hardware Disk
Adds a virtual disk to the virtual machine. While adding the virtual disk, a new VMDK file may be created or an existing VMDK file may be used to back the virtual disk.
Request
URLURL
Path Parameters
Path Parameters
Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine.
Header Parameters
Header Parameters
Required session ID, acquired from Create Session API under CIS product
vmware-api-session-id example
"b00db39f948d13ea1e59b4d6fce56389"
Request Body
Specification for the new virtual disk.
{
"backing": {
"type": "VMDK_FILE",
"vmdk_file": "string"
},
"ide": {
"master": false,
"primary": false
},
"new_vmdk": {
"capacity": 0,
"name": "string",
"storage_policy": {
"policy": "string"
}
},
"nvme": {
"bus": 0,
"unit": 0
},
"sata": {
"bus": 0,
"unit": 0
},
"scsi": {
"bus": 0,
"unit": 0
},
"type": "IDE"
}
Existing physical resource backing for the virtual disk. Exactly one of Disk.CreateSpec.backing or Disk.CreateSpec.new-vmdk must be specified. If unset, the virtual disk will not be connected to an existing backing.
Address for attaching the device to a virtual IDE adapter. If unset, the server will choose an available address; if none is available, the request will fail.
Specification for creating a new VMDK backing for the virtual disk. Exactly one of Disk.CreateSpec.backing or Disk.CreateSpec.new-vmdk must be specified. If unset, a new VMDK backing will not be created.
Address for attaching the device to a virtual NVMe adapter. If unset, the server will choose an available address; if none is available, the request will fail.
Address for attaching the device to a virtual SATA adapter. If unset, the server will choose an available address; if none is available, the request will fail.
Address for attaching the device to a virtual SCSI adapter. If unset, the server will choose an available address; if none is available, the request will fail.
The Disk.HostBusAdapterType enumerated type defines the valid types of host bus adapters that may be used for attaching a virtual storage device to a virtual machine.
IDE : Disk is attached to an IDE adapter.
SCSI : Disk is attached to a SCSI adapter.
SATA : Disk is attached to a SATA adapter.
NVME : Disk is attached to a NVMe adapter.
Possible values are: IDE , SCSI , SATA , NVME
Authentication
Response
Response BodyResponse Body
Virtual disk identifier. The result will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk.
Errors
com.vmware.vapi.std.errors.not_allowed_in_current_state : if the virtual machine is suspended or if the virtual machine is powered on and virtual disk type is IDE. | com.vmware.vapi.std.errors.resource_in_use : if the specified storage address is in use. | com.vmware.vapi.std.errors.invalid_argument : if the specified storage address is out of bounds or if the specified storage policy is invalid. | com.vmware.vapi.std.errors.unsupported : if the guest operating system of the virtual machine is not supported and spec includes unset fields that default to guest-specific values.
com.vmware.vapi.std.errors.unauthorized : if the user doesn’t have the required privileges.
com.vmware.vapi.std.errors.error : if system reported that the disk device was created but was unable to confirm the creation because the identifier of the new device could not be determined. if the system reports an error while responding to the request. | com.vmware.vapi.std.errors.unable_to_allocate_resource : if the specified storage address is unavailable; for example, if the SCSI adapter requested does not exist. | com.vmware.vapi.std.errors.resource_busy : if the virtual machine is busy performing another operation. | com.vmware.vapi.std.errors.resource_inaccessible : if the virtual machine’s configuration state cannot be accessed.
com.vmware.vapi.std.errors.service_unavailable : if the system is unable to communicate with a service to complete the request.
‘Default’ means this response is used for all HTTP codes that are not covered individually for this operation.
Code Samples
PowerCLI Client SDK Example
cURL Command
Vendor Extensions
x-vmw-doc-deprecated-method: post
x-vmw-doc-deprecated-path: /rest/vcenter/vm/{vm}/hardware/disk
x-vmw-doc-operation: create