CreateDataVolume

API Request

URLs
POST zstack/v1/volumes/data
Headers
Authorization: OAuth the-session-uuid
Body
{   "params": {     "name": "test-volume",     "description": "test-data-volume",     "diskOfferingUuid": "d8732f8e173543ef85a0c2066559ef94",     "primaryStorageUuid": "ad21b7c7f4ca4d86b348a415347ab1b5",     "resourceUuid": "e3c9ebe5b5144dd4ba791c5f2959726a"   },   "systemTags": [],   "userTags": [] }
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"test-volume","description":"test-data-volume","diskOfferingUuid":"d88594833a393e119c6fc5a8aa2ad08f","primaryStorageUuid":"5fe18eef72483c9cbde984a3176fab78","resourceUuid":"52f6075e4d6839fc8a40f569fb7d991e"}}' \ http://localhost:8080/zstack/v1/volumes/data
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The volume name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the volume. 0.6
diskOfferingUuid String body (contained in the params structure) The disk offering UUID. 0.6
primaryStorageUuid String body (contained in the params structure) Optional. The primary storage UUID. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 3.4.0
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you create a data volume in ZStack, you can specify the volume provisioning strategy by adding the volumeProvisioningStrategy option to SystemTags. The SystemTag is passed by using the dataVolumeSystemTags parameter.
    • Format of the volumeProvisioningStrategy option: volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning
    • Example: volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning

API Response

Sample Response
{   "inventory": {     "uuid": "b9d6460b286441099fa9cb3fe5bce9ec",     "name": "test-volume",     "primaryStorageUuid": "d7d84bb097da41918ee27eeb3b92d4f4",     "vmInstanceUuid": "8732b8e254ad4db18a5cad5d04315948",     "diskOfferingUuid": "7e6d828db0b84d8cb62a44e3d4badc7d",     "rootImageUuid": "8384b89b03914655b888f9b4f864ab07",     "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-b9d6460b286441099fa9cb3fe5bce9ec/b9d6460b286441099fa9cb3fe5bce9ec.qcow2",     "type": "Root",     "format": "qcow2",     "size": 1.073741824E11,     "actualSize": 2.147483648E10,     "deviceId": 0.0,     "state": "Enabled",     "status": "Ready",     "createDate": "May 11, 2017 1:22:51 PM",     "lastOpDate": "May 11, 2017 1:22:51 PM"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory VolumeInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
primaryStorageUuid String The primary storage UUID. 0.6
vmInstanceUuid String The VM instance UUID. 0.6
diskOfferingUuid String The disk offering UUID. 0.6
rootImageUuid String 0.6
installPath String 0.6
type String 0.6
format String 0.6
size Long 0.6
actualSize Long 0.6
deviceId Integer 0.6
state String 0.6
status String 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
isShareable Boolean 0.6

SDK Sample

Java SDK
CreateDataVolumeAction action = new CreateDataVolumeAction(); action.name = "test-volume"; action.description = "test-data-volume"; action.diskOfferingUuid = "cec2445214fd4e5bb10671b453d25677"; action.primaryStorageUuid = "be3baf0aa09f45ab9ae19c7b6d177ca2"; action.resourceUuid = "f2ebba352d8b43feb434f926f1635ae4"; action.sessionId = "054df264a21d40bbbdf4f292c4993842"; CreateDataVolumeAction.Result res = action.call();
Python SDK
CreateDataVolumeAction action = CreateDataVolumeAction() action.name = "test-volume" action.description = "test-data-volume" action.diskOfferingUuid = "d9ede14fbc6547808208d40658d1dbbd" action.primaryStorageUuid = "f6f7257560cd4278b2202157b45d8687" action.resourceUuid = "3344b25d00ae40c4bfab494d724cb95c" action.sessionId = "755a549dc19e400ea3b22710c5370c75" CreateDataVolumeAction.Result res = action.call()

DeleteDataVolume

API Request

URLs
DELETE zstack/v1/volumes/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 92d7ee354b4e4ed19aea6a7ebb172096" \ -X DELETE http://localhost:8080/zstack/v1/volumes/3102474ff9514720b79ff3719ab6c8e5?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The volume UUID. 0.6
deleteMode String body Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{     "error": {         "code": "SYS.1001",         "description": "A message or a operation timeout",         "details": "Create VM on KVM timeout after 300s"     } }

SDK Sample

Java SDK
DeleteDataVolumeAction action = new DeleteDataVolumeAction(); action.uuid = "0c9ca7222d914c628d60f5f38b8a5e1e"; action.deleteMode = "Permissive"; action.sessionId = "6b164d54219d4ef8a287fb4937333d54"; DeleteDataVolumeAction.Result res = action.call();
Python SDK
DeleteDataVolumeAction action = DeleteDataVolumeAction() action.uuid = "ba73b65a66ce433790526c3ee146db3b" action.deleteMode = "Permissive" action.sessionId = "fce147bb4ab540448ad4f1798e90f3f9" DeleteDataVolumeAction.Result res = action.call()

ExpungeDataVolume

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "expungeDataVolume": {},   "systemTags": [],   "userTags": [] }
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X PUT -d '{"expungeDataVolume":{}}' \ http://localhost:8080/zstack/v1/volumes/6dd47cca96f238c899aacd61867db520/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The volume UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{     "error": {         "code": "SYS.1001",         "description": "A message or a operation timeout",         "details": "Create VM on KVM timeout after 300s"     } }

SDK Sample

Java SDK
ExpungeDataVolumeAction action = new ExpungeDataVolumeAction(); action.uuid = "347edf4db9e9482a895f7aab3d7f4c26"; action.sessionId = "cc3787426fdd480f8ae6ad656b37b909"; ExpungeDataVolumeAction.Result res = action.call();
Python SDK
ExpungeDataVolumeAction action = ExpungeDataVolumeAction() action.uuid = "2dcb23f228294cab80bcd90e0024dc89" action.sessionId = "86af19d2bda54fa6bee0204b8e33d4de" ExpungeDataVolumeAction.Result res = action.call()

























Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.