Chuyển tới nội dung chính

Create Volume

POST /v3/{project_id}/volumes

To create a new volume in your project, you can send a POST request to the /v3/{project_id}/volumes endpoint of the volume service. This request requires an authentication token, which you should include in the request headers.

Request

Body Parameters

NameInTypeDescription
project_idpathstringUUID of the project in a multi-tenant cloud.
volumebodyobjectVolume wrapper object.
namebodystringOptional. Volume name.
sizebodyintegerVolume size in GiB.
descriptionbodystringOptional. Volume description.
multiattachbodybooleanOptional. Allow attaching to multiple servers; default false. Support depends on volume type.
source_volidbodystringOptional. Source volume UUID; new volume same size unless larger requested.
snapshot_idbodystringOptional. Snapshot UUID; volume created in same availability zone and size as snapshot.
backup_idbodystringOptional. Backup UUID. New in v3.47.
imageRefbodystringOptional. Image UUID to create the volume; required for bootable volumes.
volume_typebodystringOptional. Volume type (name or ID). Needed for multi-backend setups; scheduler selects backend by type.
metadatabodyobjectOptional. Key-value metadata to associate with the volume.
consistencygroup_idbodystringConsistency group UUID.
OS-SCH-HNT:scheduler_hintsbodyobjectOptional. Scheduler hints dictionary.

Sample Request

Using curl

curl -ks -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
-d '{
"volume": {
"size": 1,
"description": "Volume 2",
"name": "vol2",
"volume_type": "nvmer3"
}
}' https://api.vietnix.cloud:8776/v3/f5d834d636c642c7bfe8af86139c6f26/volumes

Using HTTP request

POST https://api.vietnix.cloud:8776/v3/f5d834d636c642c7bfe8af86139c6f26/volumes

with body

{
"volume": {
"size": 1,
"description": "Volume 2",
"name": "vol2",
"volume_type": "nvmer3"
}
}

Response

Parameters

NameTypeDescription
volumeobjectA volume object.
migration_status (Optional)stringVolume migration status. Admin only.
attachmentsarrayInstance attachment info; includes server_id, attachment_id, attached_at, host_name, volume_id, device, id. Empty if not attached.
idstringUUID of the volume.
linksarrayVolume links.
namestringVolume name.
sizeintegerSize in GiB.
bootablestringBootable attribute; instances can boot from this volume.
statusstringVolume status.
created_atstringCreation time in ISO 8601 (CCYY-MM-DDThh:mm:ss±hh:mm).
availability_zonestringAvailability zone name; may be default or null.
descriptionstringVolume description.
multiattachbooleanIf true, volume can attach to multiple instances.
source_volid (Optional)stringSource volume UUID; new volume same size unless larger requested.
volume_typestringAssociated volume type name.
encryptedbooleanIf true, the volume is encrypted.
updated_atstringLast update time in ISO 8601 or null if never updated.
replication_statusstringVolume replication status.
snapshot_id (Optional)stringSnapshot UUID; volume created in same AZ and size as the snapshot.
user_idstringUser UUID.
metadataobjectMetadata key-value pairs associated with the volume.
group_id (Optional)stringGroup ID.
consistencygroup_idstringConsistency group UUID.

Status Codes

Success

CodeReason
202 AcceptedRequest was accepted for processing, but processing has not completed. A Location header is included with a link to check the request’s progress.

Sample Response

{
"volume": {
"id": "e767560e-b1b0-4e74-b40f-486127fdb41f",
"status": "creating",
"size": 1,
"availability_zone": "nova",
"created_at": "2025-09-23T04:32:44.133966",
"updated_at": null,
"name": "vol2",
"description": "Volume 2",
"volume_type": "nvmer3",
"snapshot_id": null,
"source_volid": null,
"metadata": {},
"links": [
{
"rel": "self",
"href": "https://api.vietnix.cloud:8776/v3/f33507157a634f1cac71e06a70fb558e/volumes/e767560e-b1b0-4e74-b40f-486127fdb41f"
},
{
"rel": "bookmark",
"href": "https://api.vietnix.cloud:8776/f33507157a634f1cac71e06a70fb558e/volumes/e767560e-b1b0-4e74-b40f-486127fdb41f"
}
],
"user_id": "64166c7effeb4a89b59c073588099640",
"bootable": "false",
"encrypted": false,
"replication_status": null,
"consistencygroup_id": null,
"multiattach": false,
"attachments": []
}
}