Cns Volume Manager Cns Detach Volume

Cns Volume Manager Cns Detach Volume

Detaches volumes(block volumes only) and makes those volumes unavailable for consumption.

If a volume is already detached, this operation will pass, without any failure for that volume.

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.RemoveDisk 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, such as the volume is not attached to any VM, or the volume is not attached to the VM specfied, volume type if FILE etc.
  • 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.CnsFault set in case of any other failure scenario.
Request
URI
POST
https://{api_host}/sdk/vim25/{release}/vsan/CnsVolumeManager/{moId}/CnsDetachVolume
COPY
Path Parameters
string
moId
Required

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}.

string
release
Required

The vSphere release schema. The current specification covers vSphere 9.0.0.0 APIs.


Request Body
CnsDetachVolumeRequestType of type(s) application/json
Required
"CnsDetachVolumeRequestType Object"
array of object
detachSpecs
Required

Specification for detach operation

Authentication
This operation uses the following authentication methods.
Responses
200

Task to track the progress and overall state of this operation.

Returns MoRefTask of type(s) application/json
"MoRefTask Object"

500

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 when the volume is not attached to any VM or the volume is not attached to the VM specified or the volume ID is empty etc.

ManagedObjectNotFound: if the VM can not be found.

NotFound: if the volume can not be found.

CnsFault: Thrown for all other failure scenario.

Returns MethodFault of type(s) application/json
This response body class contains all of the following: InlineMethodFault0
"MethodFault Object"
faultCause
Optional

Fault which is the cause of this fault.

array of object
faultMessage
Optional

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.


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '[{}]' https://{api_host}/sdk/vim25/{release}/vsan/CnsVolumeManager/{moId}/CnsDetachVolume