2016-04-12 09:03:46 -04:00
|
|
|
.. -*- rst -*-
|
|
|
|
|
|
|
|
===================================================================
|
|
|
|
Servers with volume attachments (servers, os-volume\_attachments)
|
|
|
|
===================================================================
|
|
|
|
|
|
|
|
Attaches volumes that are created through the volume API to server
|
2017-03-27 09:22:10 +00:00
|
|
|
instances. Also, lists volume attachments for a server, shows
|
2016-04-12 09:03:46 -04:00
|
|
|
details for a volume attachment, and detaches a volume.
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
List volume attachments for an instance
|
|
|
|
=======================================
|
|
|
|
|
2016-06-02 08:50:03 -04:00
|
|
|
.. rest_method:: GET /servers/{server_id}/os-volume_attachments
|
2016-05-12 08:19:24 +09:00
|
|
|
|
|
|
|
List volume attachments for an instance.
|
|
|
|
|
|
|
|
Normal response codes: 200
|
|
|
|
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
|
|
|
|
Request
|
|
|
|
-------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- server_id: server_id_path
|
2016-12-15 13:20:32 -05:00
|
|
|
- limit: limit_simple
|
|
|
|
- offset: offset_simple
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Response
|
|
|
|
--------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- volumeAttachments: volumeAttachments
|
2021-08-11 14:14:12 +01:00
|
|
|
- id: volume_attachment_id_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
- serverId: server_id
|
|
|
|
- volumeId: volumeId_resp
|
2019-10-22 15:22:28 -04:00
|
|
|
- device: attachment_device_resp
|
2019-01-19 21:11:32 -05:00
|
|
|
- tag: device_tag_bdm_attachment_resp
|
2019-07-27 18:16:36 +08:00
|
|
|
- delete_on_termination: delete_on_termination_attachments_resp
|
2021-08-11 14:14:12 +01:00
|
|
|
- attachment_id: attachment_volume_id_resp
|
|
|
|
- bdm_uuid: attachment_bdm_id_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-13 14:40:24 +09:00
|
|
|
**Example List volume attachments for an instance: JSON response**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/list-volume-attachments-resp.json
|
|
|
|
:language: javascript
|
|
|
|
|
2021-08-11 14:14:12 +01:00
|
|
|
**Example List tagged volume attachments for an instance (v2.89): JSON response**
|
2019-01-19 21:11:32 -05:00
|
|
|
|
2021-08-11 14:14:12 +01:00
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.89/list-volume-attachments-resp.json
|
2019-01-19 21:11:32 -05:00
|
|
|
:language: javascript
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Attach a volume to an instance
|
|
|
|
==============================
|
|
|
|
|
2016-06-02 08:50:03 -04:00
|
|
|
.. rest_method:: POST /servers/{server_id}/os-volume_attachments
|
2016-05-12 08:19:24 +09:00
|
|
|
|
|
|
|
Attach a volume to an instance.
|
|
|
|
|
|
|
|
Normal response codes: 200
|
|
|
|
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404), conflict(409)
|
|
|
|
|
2016-09-09 22:01:00 +08:00
|
|
|
.. note:: From v2.20 attach a volume to an instance in SHELVED or SHELVED_OFFLOADED
|
|
|
|
state is allowed.
|
|
|
|
|
2016-01-21 22:10:27 +01:00
|
|
|
.. note:: From v2.60, attaching a multiattach volume to multiple instances is
|
|
|
|
supported for instances that are not SHELVED_OFFLOADED. The ability
|
|
|
|
to actually support a multiattach volume depends on the volume type
|
|
|
|
and compute hosting the instance.
|
|
|
|
|
2020-12-21 16:13:51 +00:00
|
|
|
.. note:: This is an asynchronous API, callers should poll the status and list
|
|
|
|
of attachments of the volume within the volume API to determine when
|
|
|
|
the attachment has completed successfully.
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Request
|
|
|
|
-------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- server_id: server_id_path
|
2017-03-23 16:00:46 -04:00
|
|
|
- volumeAttachment: volumeAttachment_post
|
2016-05-13 12:51:09 +09:00
|
|
|
- volumeId: volumeId
|
|
|
|
- device: device
|
2016-09-25 10:00:43 -04:00
|
|
|
- tag: device_tag_bdm_attachment
|
2019-07-27 18:16:36 +08:00
|
|
|
- delete_on_termination: delete_on_termination_attachments_req
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-13 14:40:24 +09:00
|
|
|
**Example Attach a volume to an instance: JSON request**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/attach-volume-to-server-req.json
|
|
|
|
:language: javascript
|
|
|
|
|
2016-09-25 10:00:43 -04:00
|
|
|
**Example Attach a volume to an instance and tag it (v2.49): JSON request**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.49/attach-volume-to-server-req.json
|
|
|
|
:language: javascript
|
|
|
|
|
2019-07-27 18:16:36 +08:00
|
|
|
**Example Attach a volume to an instance with "delete_on_termination" (v2.79): JSON request**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.79/attach-volume-to-server-req.json
|
|
|
|
:language: javascript
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Response
|
|
|
|
--------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- volumeAttachment: volumeAttachment
|
|
|
|
- device: device_resp
|
2021-08-11 14:14:12 +01:00
|
|
|
- id: attachment_id_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
- serverId: server_id
|
|
|
|
- volumeId: volumeId_resp
|
2019-01-19 21:11:32 -05:00
|
|
|
- tag: device_tag_bdm_attachment_resp
|
2019-07-27 18:16:36 +08:00
|
|
|
- delete_on_termination: delete_on_termination_attachments_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-13 14:40:24 +09:00
|
|
|
**Example Attach a volume to an instance: JSON response**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/attach-volume-to-server-resp.json
|
|
|
|
:language: javascript
|
|
|
|
|
2019-01-19 21:11:32 -05:00
|
|
|
**Example Attach a tagged volume to an instance (v2.70): JSON response**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.70/attach-volume-to-server-resp.json
|
|
|
|
:language: javascript
|
|
|
|
|
2019-07-27 18:16:36 +08:00
|
|
|
**Example Attach a volume with "delete_on_termination" (v2.79): JSON response**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.79/attach-volume-to-server-resp.json
|
|
|
|
:language: javascript
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Show a detail of a volume attachment
|
|
|
|
====================================
|
|
|
|
|
2017-07-06 13:26:39 +08:00
|
|
|
.. rest_method:: GET /servers/{server_id}/os-volume_attachments/{volume_id}
|
2016-05-12 08:19:24 +09:00
|
|
|
|
|
|
|
Show a detail of a volume attachment.
|
|
|
|
|
|
|
|
Normal response codes: 200
|
|
|
|
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
|
|
|
|
Request
|
|
|
|
-------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- server_id: server_id_path
|
2018-05-11 14:12:56 +09:00
|
|
|
- volume_id: volume_id_attached_path
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Response
|
|
|
|
--------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- volumeAttachment: volumeAttachment
|
2021-08-11 14:14:12 +01:00
|
|
|
- id: volume_attachment_id_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
- serverId: server_id
|
|
|
|
- volumeId: volumeId_resp
|
2019-10-22 15:22:28 -04:00
|
|
|
- device: attachment_device_resp
|
2019-01-19 21:11:32 -05:00
|
|
|
- tag: device_tag_bdm_attachment_resp
|
2019-07-27 18:16:36 +08:00
|
|
|
- delete_on_termination: delete_on_termination_attachments_resp
|
2021-08-11 14:14:12 +01:00
|
|
|
- attachment_id: attachment_volume_id_resp
|
|
|
|
- bdm_uuid: attachment_bdm_id_resp
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-13 14:40:24 +09:00
|
|
|
**Example Show a detail of a volume attachment: JSON response**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/volume-attachment-detail-resp.json
|
|
|
|
:language: javascript
|
|
|
|
|
2021-08-11 14:14:12 +01:00
|
|
|
**Example Show a detail of a tagged volume attachment (v2.89): JSON response**
|
2019-01-19 21:11:32 -05:00
|
|
|
|
2021-08-11 14:14:12 +01:00
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.89/volume-attachment-detail-resp.json
|
2019-01-19 21:11:32 -05:00
|
|
|
:language: javascript
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Update a volume attachment
|
|
|
|
==========================
|
|
|
|
|
2018-04-30 18:10:41 +08:00
|
|
|
.. rest_method:: PUT /servers/{server_id}/os-volume_attachments/{volume_id}
|
2016-05-12 08:19:24 +09:00
|
|
|
|
|
|
|
Update a volume attachment.
|
|
|
|
|
2017-07-24 12:46:21 -04:00
|
|
|
.. note:: This action only valid when the server is in ACTIVE, PAUSED and RESIZED state,
|
|
|
|
or a conflict(409) error will be returned.
|
|
|
|
|
2019-11-12 20:00:54 +08:00
|
|
|
.. warning:: When updating volumeId, this API is typically meant to
|
|
|
|
only be used as part of a larger orchestrated volume
|
|
|
|
migration operation initiated in the block storage
|
|
|
|
service via the ``os-retype`` or ``os-migrate_volume``
|
|
|
|
volume actions. Direct usage of this API to update
|
|
|
|
volumeId is not recommended and may result in needing to
|
|
|
|
hard reboot the server to update details within the guest
|
|
|
|
such as block storage serial IDs. Furthermore, updating
|
|
|
|
volumeId via this API is only implemented by `certain
|
|
|
|
compute drivers`_.
|
2018-08-24 17:47:01 -04:00
|
|
|
|
|
|
|
.. _certain compute drivers: https://docs.openstack.org/nova/latest/user/support-matrix.html#operation_swap_volume
|
|
|
|
|
2019-11-12 20:00:54 +08:00
|
|
|
Policy default role is 'rule:system_admin_or_owner', its scope is
|
|
|
|
[system, project], which allow project members or system admins to
|
|
|
|
change the fields of an attached volume of a server. Policy defaults
|
|
|
|
enable only users with the administrative role to change ``volumeId``
|
|
|
|
via this operation. Cloud providers can change these permissions
|
|
|
|
through the ``policy.json`` file.
|
2018-04-30 18:10:41 +08:00
|
|
|
|
2018-06-06 10:32:37 -04:00
|
|
|
Updating, or what is commonly referred to as "swapping", volume attachments
|
|
|
|
with volumes that have more than one read/write attachment, is not supported.
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Normal response codes: 202
|
|
|
|
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404), conflict(409)
|
|
|
|
|
|
|
|
Request
|
|
|
|
-------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- server_id: server_id_path
|
2018-04-30 18:10:41 +08:00
|
|
|
- volume_id: volume_id_swap_src
|
2017-03-23 16:00:46 -04:00
|
|
|
- volumeAttachment: volumeAttachment_put
|
2016-05-13 12:51:09 +09:00
|
|
|
- volumeId: volumeId_swap
|
2019-11-12 20:00:54 +08:00
|
|
|
- delete_on_termination: delete_on_termination_put_req
|
|
|
|
- device: attachment_device_put_req
|
|
|
|
- serverId: attachment_server_id_put_req
|
|
|
|
- tag: device_tag_bdm_attachment_put_req
|
|
|
|
- id: attachment_id_put_req
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2019-11-12 20:00:54 +08:00
|
|
|
.. note:: Other than ``volumeId``, as of v2.85 only
|
|
|
|
``delete_on_termination`` may be changed from the current
|
|
|
|
value.
|
2016-05-13 14:40:24 +09:00
|
|
|
|
2019-11-12 20:00:54 +08:00
|
|
|
**Example Update a volume attachment (v2.85): JSON request**
|
|
|
|
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-volumes/v2.85/update-volume-attachment-delete-flag-req.json
|
2016-05-13 14:40:24 +09:00
|
|
|
:language: javascript
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Response
|
|
|
|
--------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
No body is returned on successful request.
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Detach a volume from an instance
|
|
|
|
================================
|
|
|
|
|
2017-07-06 13:26:39 +08:00
|
|
|
.. rest_method:: DELETE /servers/{server_id}/os-volume_attachments/{volume_id}
|
2016-05-12 08:19:24 +09:00
|
|
|
|
|
|
|
Detach a volume from an instance.
|
|
|
|
|
|
|
|
Normal response codes: 202
|
|
|
|
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404), conflict(409)
|
|
|
|
|
2016-09-09 22:01:00 +08:00
|
|
|
.. note:: From v2.20 detach a volume from an instance in SHELVED or SHELVED_OFFLOADED
|
|
|
|
state is allowed.
|
|
|
|
|
2020-12-21 16:13:51 +00:00
|
|
|
.. note:: This is an asynchronous API, callers should poll the list
|
|
|
|
of volume attachments provided by ``GET
|
|
|
|
/servers/{server_id}/os-volume_attachments`` to determine when the
|
|
|
|
detachment of the volume has completed successfully.
|
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Request
|
|
|
|
-------
|
|
|
|
|
2016-05-13 12:51:09 +09:00
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
|
|
|
|
- server_id: server_id_path
|
2018-05-11 14:12:56 +09:00
|
|
|
- volume_id: volume_id_to_detach_path
|
2016-05-13 12:51:09 +09:00
|
|
|
|
2016-05-12 08:19:24 +09:00
|
|
|
Response
|
|
|
|
--------
|
2016-05-13 12:51:09 +09:00
|
|
|
|
|
|
|
No body is returned on successful request.
|