Managing Storage Attachments

A storage attachment is an association between a storage volume and an instance. You can attach a storage volume to an instance either at launch time (by using a launch plan in an orchestration) or after an instance is running (by using UI, CLI and API). Each volume may only be attached to one instance at a time. To detach a storage volume from an instance, delete the associated storage attachment object.

Note:

The storage attachment must exist within the tenant name-space of the instance owner.

add storageattachment

This command enables you to attach a storage volume to an instance.

Syntax

oracle-compute add storageattachment instance_name storage_volume_name index

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
instance_name Name of the instance to which the volume should be attached
storage_volume_name Name of the storage volume to which the instance should be attached
index Index number for the volume. The allowed range is 1 to 10. The index determines the device name by which this volume is exposed to the instance ( for example, /dev/sdal1). The index to device mapping is as follows:
  • 1—/dev/xvdb

  • 2—/dev/xvdc, and so on

Example

$ oracle-compute add storageattachment /mytenant/public/1a9ce3a1-ddba-44f7-9cc5-04c77f6523bc /mytenant/public/storagevolume-data 1

delete storageattachment

This command enables you to detach a storage volume from a specific instance.

If the instance is in the running state, then you must first unmount the storage volume in the instance. Log in to the instance, identify the storage volume, and unmount the storage volume using the command umount path-to-disk-mount-point.

Syntax

oracle-compute delete storageattachment name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name System-generated name of the storage attachment to be deleted

Example

$ oracle-compute delete storageattachment /mytenant/public/1a9ce3a1-ddba-44f7-9cc5-04c77f6523bc/8a6551a2-af25-4616-98e8-50db17da8f64

Retrieve Storage Attachment Details

You can retrieve storage attachment details by using the CLI.

discover storageattachment

This command enables you to discover storage attachments in a specific container or subcontainer.

Syntax

oracle-compute discover storageattachment container

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
container Hierarchical name-space containing the storage attachments

Example

$ oracle-compute discover storageattachment /mytenant/public/

Sample Output

$ oracle-compute discover storageattachment /mytenant/public/ 
entry 
/mytenant/public/1a9ce3a1-ddba-44f7-9cc5-04c77f6523bc/

get storageattachment

This command enables you to retrieve information for a specific storage attachment.

Syntax

oracle-compute get storageattachment name

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Parameter Description
name System-generated name of the storage attachment

Example

$ oracle-compute get storageattachment /mytenant/public/960adf49-eefd-4f93-a300-2c798ba4a123/a74237e5-53a5-49e9-9167-f09f3697a6bb

Sample Output

$ oracle-compute get storageattachment /mytenant/public/960adf49-eefd-4f93-a300-2c798ba4a123/a74237e5-53a5-49e9-9167-f09f3697a6bb -F storage_volume_name,index,hypervisor,state,readonly -ftab

storage_volume_name        index hypervisor state     readonly
/mytenant/public/vm2_vol02 2     None       attached  False

list storageattachment

This command enables you to list details about the storage attachment in a specific container.

Syntax

oracle-compute list storageattachment container [--name] [--instance_name] [--state] [--storage_volume_name]

Parameters and Options

The following parameters are specific to this command. You can also use the common options described in General Command Options.

Note:

The output of this command is filtered based on the optional parameters (if specified).

Parameter Description
container Hierarchical name-space containing the storage attachments
--name (Optional) Name of the attachment, automatically generated by the server
--instance_name (Optional) Name of the instance to which the volume is attached
--state (Optional) Attachment state. The following values are supported:
  • attaching

    The storage attachment is in the process of attaching to the instance.

  • attached

    The storage attachment is attached to the instance.

  • detaching

    The storage attachment is in the process of detaching to the instance.

  • unavailable

    The storage attachment is unavailable.

  • error

    The storage attachment is in error state.

--storage_volume_name (Optional) Name of the storage volume to which the instance is attached

Example

$ oracle-compute list storageattachment /mytenant/public/

Sample Output

$ oracle-compute list storageattachment /mytenant/public/ -Fname,state
name                                                                                       state
/mytenant/public/960adf49-eefd-4f93-a300-2c798ba4a123/a74237e5-53a5-49e9-9167-f09f3697a6bb attached
/mytenant/public/960adf49-eefd-4f93-a300-2c798ba4a123/eaa6406a-49ce-4912-b2bc-4e5b410c3735 attached
/mytenant/public/ff94e915-a1d1-4f0f-88de-cc41b91394d3/5d28def6-10fc-4b9e-b80c-f3849f1490c0 attached
/mytenant/public/ff94e915-a1d1-4f0f-88de-cc41b91394d3/836b7374-e56a-4adb-a53c-403d20b7895f attached