Virtual Machine Attach Disk Task
Attach an existing disk to this virtual machine.
A minimum virtual machine version of 'vmx-13' is required for this operation to succeed. If a compatible VM version is not satisfied, a DeviceUnsupportedForVmVersion fault will be thrown.
Required privileges: VirtualMachine.Config.AddExistingDisk
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 VirtualMachine/{moId}
.
The vSphere release schema. The current specification covers vSphere 8.0.3.0 APIs.
Show optional properties
{
"diskId": {
"id": "string"
},
"datastore": {}
}
{
"diskId": {
"_typeName": "string",
"id": "string"
},
"datastore": {
"_typeName": "string",
"type": "string",
"value": "string"
},
"controllerKey": 0,
"unitNumber": 0
}
This data object type describes an identifier class which is globally unique to identify the associated object.
Key of the controller the disk will connect to. It can be unset if there is only one controller (SCSI or SATA) with the available slot in the virtual machine. If there are multiple SCSI or SATA controllers available, user must specify the controller; if there is no available controllers, a MissingController fault will be thrown.
The unit number of the attached disk on its controller. If unset, the next available slot on the specified controller or the only available controller will be assigned to the attached disk.
OK
{
"_typeName": "string",
"type": "string",
"value": "string"
}
NotFound: if the disk object cannot be found.
VmConfigFault: if the virtual machine's configuration is invalid.
FileFault: if there is a problem creating or accessing the virtual machine's files for this operation.
InvalidState: if the operation cannot be performed in the current state of the virtual machine. For example, because the virtual machine's configuration is not available.
InvalidDatastore: If the datastore cannot be found or inaccessible.
InvalidController: If the specified controller cannot be found or the specified unitNumber is already taken, or the controller has no free slots.
MissingController: If the virtual machine has no or more than one available controllers when controllerKey is unset.
DeviceUnsupportedForVmVersion: If the virtual machine's version is incompatible for the given device.
{
"_typeName": "string",
"faultCause": "MethodFault Object",
"faultMessage": [
{
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
}
]
}