Cns Volume Manager Cns Attach Volume
Attaches volumes(block volumes only) to specified VM instances, to make volumes ready for mount and consumption by respective containers.
For each volume in input, this API will attach block backing for this volume to the VirtualMachine specified in input, via one of the available slots on SCSI controller. This API will transparently add new SCSI controller to the VirtualMachine, if needed.
Following privileges will be required on specified entities, to perform this operation:
- Datastore.FileManagement on datastores specified in input, required for block volume only
- VirtualMachine.Config.AddExistingDisk on VM specified in the input
- VirtualMachine.Config.AddRemoveDevice on VM specified in the input
Faults that can be set in individual result entry, corresponding to each VolumeAttachDetachSpec instance in input:
- vmodl.fault.InvalidArgument set in case of invalid input arguments, like empty strings, invalid formats, invalid combination of inputs.
- vmodl.fault.ManagedObjectNotFound set in case of the VM can not be found.
- vim.fault.NotFound set in case of the volume can not be found.
- vim.fault.ResourceInUse set when volume has been attached to a VM and is in use, client needs to first detach the volume from that VM and then retry this operation.
- vim.fault.CnsMissingControllerFault set if the virtual machine has no available controller when controllerKey is unset, it is inherited from vim.fault.CnsFault.
- vim.fault.CnsFault set in case of any other failure scenario.
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 CnsVolumeManager/{moId}
.
The vSphere release schema. The current specification covers vSphere 9.0.0.0 APIs.
"CnsAttachVolumeRequestType Object"
Specification for attach operation
Task to track the progress and overall state of this operation.
"MoRefTask Object"
InvalidArgument: This API supports input size of 1 only. If more or less than one entries are passed as input, this exception will be thrown and operation will fail. This fault will occur in cases where the volume ID is empty, VM is not present, volume type is FILE etc.
ManagedObjectNotFound: if the VM can not be found.
NotFound: if the volume can not be found.
ResourceInUse: if the volume has been attached a VM and is in use, client needs to first detach the volume from that VM and then retry this operation.
CnsFault: Thrown for all other failure scenario.
"MethodFault Object"
Fault which is the cause of this fault.
Message which has details about the error Message can also contain a key to message catalog which can be used to generate better localized messages.
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/vsan/CnsVolumeManager/{moId}/CnsAttachVolume