13.9. Listing volumes of virtual machines

GET /servers/{server_id}/os-volume_attachments

List volumes that are attached to the given virtual machine.

Source: https://docs.openstack.org/api-ref/compute/?expanded=list-volume-attachments-for-an-instance-detail

13.9.1. Request

Name In Type Description
server_id path string The UUID of the server.
limit (Optional) query integer Used in conjunction with offset to return a slice of items. limit is the maximum number of items to return. If limit is not specified, or exceeds the configurable max_limit, then max_limit will be used instead.
offset (Optional) query integer Used in conjunction with limit to return a slice of items. offset is where to start in the list.

13.9.1.1. Examples

List all volumes that are attached to a VM with the specified ID.

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
https://<node_IP_addr>:8774/v2.1/b906404c55bb44729da99987536ac5bc/servers/0785ee80-1eca-426b-b8c4-5b499fc7f614/os-volume_attachments

13.9.2. Response

Name In Type Description
volumeAttachments body array The list of volume attachments.
device body string Name of the device such as, /dev/vdb.
id body string The UUID of the volume.
serverId (Optional) body string The UUID of the server.
volumeId (Optional) body string The UUID of the attached volume.
tag body string

The device tag applied to the volume block device or null.

New in version 2.70

delete_on_termination body boolean

A flag indicating if the attached volume will be deleted when the server is deleted.

New in version 2.79

13.9.2.1. Status codes

13.9.2.1.1. Success

Code Reason
200 - OK Request was successful.

13.9.2.1.2. Error

Code Reason
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.
404 - Not Found The requested resource could not be found.

13.9.2.2. Example

{
  "volumeAttachments": [
    {
      "device": "/dev/vdb",
      "serverId": "0785ee80-1eca-426b-b8c4-5b499fc7f614",
      "id": "16cd801e-f3c1-4cac-aa6c-aecf22642a89",
      "volumeId": "16cd801e-f3c1-4cac-aa6c-aecf22642a89"
    }, 
    {
      "device": "/dev/vda",
      "serverId": "0785ee80-1eca-426b-b8c4-5b499fc7f614",
      "id": "57a6d81f-520b-4bb1-9fcd-1117ae56b9fb",
      "volumeId": "57a6d81f-520b-4bb1-9fcd-1117ae56b9fb"
    }
  ]
}