• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Volumes
  6. Creating a Volume

Creating a Volume

Function Description

This interface is used to create a volume.

URI

  • URI format

    POST /v2/{tenant_id}/os-volumes

    POST /v2.1/{tenant_id}/os-volumes

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

Restrictions

This interface will become invalid from micro version 2.36. Since this version, the system will return error 404 when you invoke this interface. Using the corresponding storage service interface is recommended.

Request

Parameter

Type

Mandatory

Description

availability_zone

String

No

Specifies the AZ to which the volume to be created belongs.

If the specified AZ does not exist, creating the volume failed, and the volume is in error state.

The AZ to which the volume to be created belongs must be specified in the public cloud system.

display_description

String

No

Specifies the volume description.

snapshot_id

String

No

Specifies the snapshot ID.

If this parameter is specified, the volume is to be created from a snapshot.

size

Int

Yes

If the volume is to be created from a snapshot, this parameter is optional.

Specifies the volume size.

Unit: GB

display_name

String

No

Specifies the volume name.

volume_type

String

No

Specifies the volume type.

Currently, the value can be SSDSASSATAco-p1, or  uh-l1.
  • SSD: specifies the ultra-I/O disk type.
  • SAS: specifies the high I/O disk type.
  • SATA: specifies the common I/O disk type.
  • co-p1: specifies the high I/O (performance-optimized I) disk type.
  • uh-l1: specifies the ultra-high I/O (latency-optimized) disk type.
    NOTE:

    EVS disks of the co-p1 and uh-l1 types are used exclusively for high performance computing (HPC) and SAP HANA ECSs.

metadata

Dict

No

Specifies the volume metadata.

Response

Parameter

Type

Mandatory

Description

id

String

Yes

Specifies the disk ID in UUID format.

displayName

String

No

Specifies the volume name.

status

String

Yes

Specifies the volume status.

attachments

List

No

Specifies the volume attachment information.

availabilityZone

String

Yes

Specifies the AZ to which the volume belongs.

createdAt

String

Yes

Specifies the time when the volume was created.

displayDescription

String

No

Specifies the volume description.

volumeType

String

Yes

Specifies the volume type.

snapshotId

String

No

Specifies the snapshot ID.

metadata

Dict

Yes

Specifies the volume metadata.

size

Int

Yes

Specifies the size of the volume.

Request Example

POST /v2/b84c367e4d1047fc9b54f28b400ddbc2/os-volumes
POST /v2.1/b84c367e4d1047fc9b54f28b400ddbc2/os-volumes
{
    "volume": {
        "availability_zone": "az1.dc1",
        "display_description": "test1",
        "snapshot_id": null,
        "size": 1,
        "display_name": "test",
        "volume_type": "SATA",
        "metadata": {
            "testkey": "testvalue"
        }
    }
}

Response Example

{
  "volume": {
    "displayDescription": "test1",
    "volumeType": "SATA",
    "createdAt": "2018-05-18T01:17:03.871808",
    "metadata": {
      "testkey": "testvalue",
      "resourceSpecCode": "SATA",
      "resourceType": "hws.resource.type.volume",
      "billing": "1"
    },
    "attachments": [
      {}
    ],
    "snapshotId": null,
    "size": 1,
    "displayName": "test",
    "id": "b4fb891c-c665-4478-92b0-8a7fa65a57cd",
    "availabilityZone": "az1.dc1",
    "status": "creating"
  }
}

Returned Values

See General Request Returned Values.