• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Disk Management
  6. Attaching a Disk to an ECS

Attaching a Disk to an ECS

Function

This API is used to attach a disk to an ECS.

Constraints

  1. If you attach a bootable disk to an ECS, you must specify the disk drive letter.
  2. A disk created using a backup cannot be attached to an ECS as the system disk.
  3. An ECS in the SUSPENDED or PAUSED state, which is specified using the OS-EXT-STS:vm_state parameter of the ECS, cannot have a disk attached.
  4. The EVS must be in the available status.
  5. The EVS disk and the target ECS must be located in the same AZ.

URI

POST /v2.1/{project_id}/servers/{server_id}/os-volume_attachments

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Request parameters

Table 2 describes the request parameters.
Table 2 Request parameters

Parameter

Type

Mandatory

Description

volumeAttachment

Dict

Yes

Specifies the volumes to be attached. For details, see Table 3.

Table 3 volumeAttachment field description

Parameter

Type

Mandatory

Description

volumeId

String

Yes

Specifies the ID of the disk to be attached. The value is in UUID format.

device

String

No

Specifies the device name, such as /dev/sda or /dev/sdb.

The new disk device name cannot be the same as an existing one.

The device name must be specified based on the sequence of existing device names. Otherwise, the system automatically generates one.

NOTE:

VBD disk device names can only be /dev/vdb through /dev/vdx. You are advised to attach the VBD disks in alphabetical order. Otherwise, the disk drive letters may be incorrect on the ECS.

Response

Response parameters

Table 4 describes the response parameters.
Table 4 Response parameters

Parameter

Type

Description

device

String

Specifies the device name.

serverId

String

Specifies the ID of the target ECS in UUID format.

id

String

Specifies the disk ID in UUID format.

volumeId

String

Specifies the attaching ID, which is the same as the UUID.

Examples

  • Example request
    {
        "volumeAttachment": {
            "volumeId": "54667652-3029-4af8-9222-2d53066fd61c",
            "device": "/dev/sdb"
        }
    }
  • Example response
    {
        "volumeAttachment": {
            "device": "/dev/vdb",
            "serverId": "ab258e25-e351-47c7-b6e3-0749c5d9ed6a",
            "id": "54667652-3029-4af8-9222-2d53066fd61c",
            "volumeId": "54667652-3029-4af8-9222-2d53066fd61c"
        }
    }

Returned Values

See General Request Returned Values.