Storage Management


Data Storage APIs


Delete Data Storage (DeletePrimaryStorage)

API Request

URLs

DELETE zstack/v1/primary-storage/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth af6279db8d5d4434afe789fdb214fe86" \ -X DELETE http://localhost:8080/zstack/v1/primary-storage/84ecb184e2f649ac9300f804dfd9f43e?deleteMode=Permissive

Parameter List

Name Type Location Description Allowed Values Starting Version
uuid String url Data Storage UUID, uniquely identifies the resource 0.6
deleteMode (Optional) String body Delete Mode (Permissive or Enforcing, default is Permissive) 0.6
systemTags (Optional) List body System Tags 0.6
userTags (Optional) List body User Tags 0.6

API Response

When this API succeeds, it returns an empty JSON structure {}. When an error occurs, the returned JSON structure contains 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 Examples

Java SDK
DeletePrimaryStorageAction action = new DeletePrimaryStorageAction(); action.uuid = "c471a57db90945129303e69cf731fee3"; action.deleteMode = "Permissive"; action.sessionId = "34041f0d587e4ce1827dd88f34a0a94b"; DeletePrimaryStorageAction.Result res = action.call();

Python SDK

DeletePrimaryStorageAction action = DeletePrimaryStorageAction() action.uuid = "309a9da1c0884e679dd7f96502130ce3" action.deleteMode = "Permissive" action.sessionId = "0aa8b461719c45eea867c0be49565489" DeletePrimaryStorageAction.Result res = action.call()

Query Data Storage (QueryPrimaryStorage)

API Request

URLs
GET zstack/v1/primary-storage
Headers
Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth f889c6a0220c4b34b3007f72bd04e839" \ -X GET http://localhost:8080/zstack/v1/primary-storage?q=uuid=2160b1e46b0a422fbc9ce6e4a7de1023

Queryable Fields

Run the CLI command tool, enter QueryPrimaryStorage and press Tab to view all queryable fields and resource names that can be queried across tables.

API Response

Response Example
{ "inventories": [     { "name": "PS1", "url": "/Cloud_ps", "type": "LocalStorage", "state": "Enabled", "status": "Connected", "attachedClusterUuids": [ "efbdb96e4f9c457eacf11dcb19923af9"       ]     }   ] }
Name Type Description Starting Version
error ErrorCode Error code. If not null, the operation failed. When the operation succeeds, this field is null. See error 0.6
inventories List See inventories 0.6
#error
Name Type Description Starting Version
code String Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field, defaults to null 0.6
opaque LinkedHashMap Reserved field, defaults to null 0.6
cause ErrorCode Root cause, the source error that caused the current error. If there is no original error, this field is null 0.6
#inventories
Name Type Description Starting Version
uuid String Resource UUID, uniquely identifies the resource 0.6
zoneUuid String Data Center UUID 0.6
name String Resource Name 0.6
url String 0.6
description String Resource Description 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp Create Time 0.6
lastOpDate Timestamp Last Modification Time 0.6
attachedClusterUuids List 0.6

SDK Examples

Java SDK
QueryPrimaryStorageAction action = new QueryPrimaryStorageAction(); action.conditions = asList("uuid=56235f6bf5c24513bce99d4ec824c63f"); action.sessionId = "16f5568fa9aa48e79b3a3ed579787fd0"; QueryPrimaryStorageAction.Result res = action.call();
Python SDK
QueryPrimaryStorageAction action = QueryPrimaryStorageAction() action.conditions = ["uuid=52f2459af9ce4c35a0c7de9c98aaebb0"] action.sessionId = "ade5be353d114f948f976ae43d397815" QueryPrimaryStorageAction.Result res = action.call()

Attach Data Storage to Cluster (AttachPrimaryStorageToCluster)

API Request

URLs
POST zstack/v1/clusters/{clusterUuid}/primary-storage/{primaryStorageUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{   "params": {},   "systemTags": [],   "userTags": [] } 
Note: In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/clusters/06fa0d99fd9733409ea9dcb29e070fcf/primary-storage/e6df72f4eaaa324fb650cb7165bff218
Parameter List
Name Type Location Description Allowed Values Starting Version
clusterUuid String url Cluster UUID 0.6
primaryStorageUuid String url Data Storage UUID 0.6
systemTags (Optional) List body System Tags 0.6
userTags (Optional) List body User Tags 0.6

API Response

Response Example
{ "inventory": { "name": "PS1", "url": "/Cloud_ps", "type": "LocalStorage", "state": "Enabled", "status": "Connected", "attachedClusterUuids": [ "f0262ff5aeb54cd19e0a33bfaa61f5a4"     ]   } }
Name Type Description Starting Version
success boolean 4.7.0
error ErrorCode Error code. If not null, the operation failed. When the operation succeeds, this field is null. See error 0.6
inventory PrimaryStorageInventory See inventory 0.6
#error
Name Type Description Starting Version
code String Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 0.6
description String Brief description of the error 0.6
details String Detailed error information 0.6
elaboration String Reserved field, defaults to null 0.6
opaque LinkedHashMap Reserved field, defaults to null 0.6
cause ErrorCode Root cause, the source error that caused the current error. If there is no original error, this field is null 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, uniquely identifies the resource 0.6
zoneUuid String Data Center UUID 0.6
name String Resource Name 0.6
url String 0.6
description String Resource Description 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp Create Time 0.6
lastOpDate Timestamp Last Modification Time 0.6
attachedClusterUuids List 0.6

SDK Examples

Java SDK
AttachPrimaryStorageToClusterAction action = new AttachPrimaryStorageToClusterAction(); action.clusterUuid = "473e453a99844ea2a3b65aa637d33841"; action.primaryStorageUuid = "ffd9b14c1c3442f2bde3209cbe9cc195"; action.sessionId = "97c7848a46b44ba89f348f434b5f2288"; AttachPrimaryStorageToClusterAction.Result res = action.call();
Python SDK
AttachPrimaryStorageToClusterAction action = AttachPrimaryStorageToClusterAction() action.clusterUuid = "cfae196b0d514f9fbc6ecd5360cb6ccf" action.primaryStorageUuid = "c122244cd9ab48fa80f61e781e98bb03" action.sessionId = "c5b2cc8440fc4a6299c5f96a37d38a7f" AttachPrimaryStorageToClusterAction.Result res = action.call()

























































































Archives

Download Document Archives

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Cannot be empty.
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.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

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)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

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)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

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.