Skip to main content

volume_attachments

Creates, updates, deletes, gets or lists a volume_attachments resource.

Overview​

Namevolume_attachments
TypeResource
Idoci.compute.volume_attachments

Fields​

The following fields are returned by SELECT queries:

The volume attachment was retrieved.

NameDatatypeDescription
idstringThe OCID of the volume attachment.
attachmentTypestringThe type of volume attachment.
availabilityDomainstringThe availability domain of an instance. Example: Uocm:PHX-AD-1
compartmentIdstringThe OCID of the compartment.
devicestringThe device name.
displayNamestringA user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
instanceIdstringThe OCID of the instance the volume is attached to.
isMultipathbooleanWhether the Iscsi or Paravirtualized attachment is multipath or not, it is not applicable to NVMe attachment.
isPvEncryptionInTransitEnabledbooleanWhether in-transit encryption for the data volume's paravirtualized attachment is enabled or not.
isReadOnlybooleanWhether the attachment was created in read-only mode.
isShareablebooleanWhether the attachment should be created in shareable mode. If an attachment is created in shareable mode, then other instances can attach the same volume, provided that they also create their attachments in shareable mode. Only certain volume types can be attached in shareable mode. Defaults to false if not specified.
isVolumeCreatedDuringLaunchbooleanFlag indicating if this volume was created for the customer as part of a simplified launch. Used to determine whether the volume requires deletion on instance termination.
iscsiLoginStatestringThe iscsi login state of the volume attachment. For a Iscsi volume attachment, all iscsi sessions need to be all logged-in or logged-out to be in logged-in or logged-out state. (UNKNOWN, LOGGING_IN, LOGIN_SUCCEEDED, LOGIN_FAILED, LOGGING_OUT, LOGOUT_SUCCEEDED, LOGOUT_FAILED)
lifecycleStatestringThe current state of the volume attachment. (ATTACHING, ATTACHED, DETACHING, DETACHED)
timeCreatedstring (date-time)The date and time the volume was created, in the format defined by [RFC3339](https:​//tools.ietf.org/html/rfc3339). Example: 2016-08-25T21:10:29.600Z
volumeIdstringThe OCID of the volume.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectvolumeAttachmentId, regionGets information about the specified volume attachment.
listselectcompartmentId, regionavailabilityDomain, limit, page, instanceId, volumeIdLists the volume attachments in the specified compartment. You can filter the<br />list by specifying an instance OCID, volume OCID, or both.<br /><br />Currently, the only supported volume attachment type are [IScsiVolumeAttachment](#/en/iaas/latest/IScsiVolumeAttachment/) and<br />[ParavirtualizedVolumeAttachment](#/en/iaas/latest/ParavirtualizedVolumeAttachment/).<br />
attachinsertregion, instanceId, volumeId, typeopc-retry-tokenAttaches the specified storage volume to the specified instance.<br />
updateupdatevolumeAttachmentId, regionopc-request-id, if-matchUpdates information about the specified volume attachment.
detachdeletevolumeAttachmentId, regionif-matchDetaches a storage volume from an instance. You must specify the OCID of the volume attachment.<br /><br />This is an asynchronous operation. The attachment's lifecycleState will change to DETACHING temporarily<br />until the attachment is completely removed.<br />

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
compartmentIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment.
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
volumeAttachmentIdstringThe OCID of the volume attachment.
availabilityDomainstringThe name of the availability domain. Example: Uocm:PHX-AD-1
if-matchstringFor optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
instanceIdstringThe OCID of the instance.
limitintegerFor list pagination. The maximum number of results per page, or items to return in a paginated "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). Example: 50
opc-request-idstringUnique identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
pagestringFor list pagination. The value of the opc-next-page response header from the previous "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine).
volumeIdstringThe OCID of the volume.

SELECT examples​

Gets information about the specified volume attachment.

SELECT
id,
attachmentType,
availabilityDomain,
compartmentId,
device,
displayName,
instanceId,
isMultipath,
isPvEncryptionInTransitEnabled,
isReadOnly,
isShareable,
isVolumeCreatedDuringLaunch,
iscsiLoginState,
lifecycleState,
timeCreated,
volumeId
FROM oci.compute.volume_attachments
WHERE volumeAttachmentId = '{{ volumeAttachmentId }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples​

Attaches the specified storage volume to the specified instance.<br />

INSERT INTO oci.compute.volume_attachments (
device,
displayName,
instanceId,
isReadOnly,
isShareable,
type,
volumeId,
region,
opc-retry-token
)
SELECT
'{{ device }}',
'{{ displayName }}',
'{{ instanceId }}' /* required */,
{{ isReadOnly }},
{{ isShareable }},
'{{ type }}' /* required */,
'{{ volumeId }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}'
RETURNING
id,
attachmentType,
availabilityDomain,
compartmentId,
device,
displayName,
instanceId,
isMultipath,
isPvEncryptionInTransitEnabled,
isReadOnly,
isShareable,
isVolumeCreatedDuringLaunch,
iscsiLoginState,
lifecycleState,
timeCreated,
volumeId
;

UPDATE examples​

Updates information about the specified volume attachment.

UPDATE oci.compute.volume_attachments
SET
iscsiLoginState = '{{ iscsiLoginState }}'
WHERE
volumeAttachmentId = '{{ volumeAttachmentId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id}}'
AND if-match = '{{ if-match}}'
RETURNING
id,
attachmentType,
availabilityDomain,
compartmentId,
device,
displayName,
instanceId,
isMultipath,
isPvEncryptionInTransitEnabled,
isReadOnly,
isShareable,
isVolumeCreatedDuringLaunch,
iscsiLoginState,
lifecycleState,
timeCreated,
volumeId;

DELETE examples​

Detaches a storage volume from an instance. You must specify the OCID of the volume attachment.<br /><br />This is an asynchronous operation. The attachment's lifecycleState will change to DETACHING temporarily<br />until the attachment is completely removed.<br />

DELETE FROM oci.compute.volume_attachments
WHERE volumeAttachmentId = '{{ volumeAttachmentId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
;