Updated on 2024-05-17 GMT+08:00

Attaching an EVS Disk to a BMS

Function

This API is used to attach EVS disks to a BMS as data disks after the BMS is created if existing disks are insufficient or cannot meet requirements.

Constraints

  • EVS disks cannot be attached to a BMS in a batch.
  • A maximum of 60 EVS disks can be attached to a BMS.
  • A bootable disk cannot be attached to a BMS.
  • A disk cannot be attached to a BMS in the PAUSED state. The state is indicated by the OS-EXT-STS:vm_state parameter.
  • Only a shared disk or a disk in the available state can be attached to a BMS.
  • Only EVS disks whose device type is SCSI can be attached to a BMS.

URI

POST /v1/{project_id}/baremetalservers/{server_id}/attachvolume

Table 1 lists the parameters.

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

server_id

Yes

Specifies the BMS ID.

You can obtain the BMS ID from the BMS console or by calling the Querying BMSs (Native OpenStack API).

Request Parameters

Parameter

Mandatory

Type

Description

volumeAttachment

Yes

Object

Specifies the disks to be attached. For details, see Table 2.

Table 2 volumeAttachment field data structure description

Parameter

Mandatory

Type

Description

volumeId

Yes

String

Specifies the ID of the disk to be attached to a BMS.

You can obtain the disk ID from the EVS console or by calling the Querying EVS Disks.

device

No

String

Specifies the mount point, such as /dev/sda and /dev/sdb.

The new disk mount point cannot be the same as an existing one.

The mount point must be specified based on the sequence of existing device names. If this parameter is left blank or set to "", the system automatically generates a mount point.

Example Request

Attaching an EVS disk (ID: b53f23bd-ee8f-49ec-9420-d1acfeaf91d6) to a BMS (ID: cf2a8b97-b5c6-47ef-9714-eb27adf26e5b)
1
POST https://{BMS Endpoint}/v1/bbf1946d374b44a0a2a95533562ba954/baremetalservers/cf2a8b97-b5c6-47ef-9714-eb27adf26e5b/attachvolume
1
2
3
4
5
6
{
    "volumeAttachment": {
        "volumeId": "b53f23bd-ee8f-49ec-9420-d1acfeaf91d6",
        "device": ""
    }
}

Response Parameters

Table 3 Normal response

Parameter

Type

Description

job_id

String

Specifies the task ID returned after a task command is issued. The task ID can be used to query the execution status of the task.

For details about how to query the task execution status based on job_id, see Querying Task Statuses.

Table 4 Abnormal response

Parameter

Type

Description

error

Dictionary data structure

Specifies the error returned when a task submission encounters an exception. For details, see Table 5.

Table 5 error data structure

Parameter

Type

Description

message

String

Specifies the error message.

code

String

Specifies the error code.

Example Response

  • Normal response
    1
    2
    3
    { 
        "job_id": "70a599e0-31e7-49b7-b260-868f441e862b" 
    } 
    

Returned Values

Normal values

Returned Value

Description

202

The request has been accepted, but the processing has been delayed.

For details about other returned values, see Status Codes.

Error Codes

See Error Codes.