Document navigation

Disk Offering Operations

CreateDiskOffering

API Request

URLs
POST zstack/v1/disk-offerings
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"name": "diskOffering1",
"diskSize": 100.0,
"sortKey": 0.0
  },
"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":"diskOffering1","diskSize":100.0,"sortKey":0.0}}' \
http://localhost:8080/zstack/v1/disk-offerings
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
diskSize long body (contained in the params structure) The volume size. 0.6
sortKey int body (contained in the params structure) Optional. The sort key. 0.6
allocationStrategy String body (contained in the params structure) Optional. The allocation strategy.
  • DefaultHostAllocatorStrategy
  • LastHostPreferredAllocatorStrategy
  • LeastVmPreferredHostAllocatorStrategy
  • MinimumCPUUsageHostAllocatorStrategy
  • MinimumMemoryUsageHostAllocatorStrategy
  • MaxInstancePerHostHostAllocatorStrategy
  • LeastVolumePrimaryStorageAllocationStrategy
  • MaximumAvailableCapacityAllocationStrategy
  • CustomOrderPrimaryStorageAllocationStrategy
0.6
type String body (contained in the params structure) Optional. The type. 0.6
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6
Note:
  • When you create a disk offering in ZStack Cloud, you can customize the disk offering parameters by adding the diskOfferingUserConfig option to SystemTags.
    • Format of the diskOfferingUserConfig option: diskOfferingUserConfig::xxx. Here, xxx must be a JSON string.
      For example, to specify multiple primary storage for a disk offering, you can use diskOfferingUserConfig::
      {
          "allocate": {
              "primaryStorages":[
                  {
                      "type":"Enter a primary storage type",
                      "uuid":"Enter a primary storage UUID"
                  },
                  {
                      "type":"Enter a primary storage type",
                      "uuid":"Enter a primary storage UUID"
                  },
                  {
                      "type":"Enter a primary storage type",
                      "uuid":"Enter a primary storage UUID"
                  }
              ]
          }
      
      }

API Response

Sample Response
{
"inventory": {
"uuid": "e7a865815cd34dd29812d335dc1019bf",
"name": "diskOffering1",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
  }
}
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 DiskOfferingInventory 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
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
CreateDiskOfferingAction action = new CreateDiskOfferingAction();
action.name = "diskOffering1";
action.diskSize = 100.0;
action.sortKey = 0.0;
action.sessionId = "5c780b5178c0432b9f86a758c4c75ea1";
CreateDiskOfferingAction.Result res = action.call();
Python SDK
CreateDiskOfferingAction action = CreateDiskOfferingAction()
action.name = "diskOffering1"
action.diskSize = 100.0
action.sortKey = 0.0
action.sessionId = "f930e0f78ce948778c8c3f1cbcd0c4ec"
CreateDiskOfferingAction.Result res = action.call()

DeleteDiskOffering

API Request

URLs
DELETE/v1/disk-offerings/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth e12cbd12fbd54afd96c463c093ce1ed9" \
-X DELETE http://localhost:8080/zstack/v1/disk-offerings/6313fb03124a4aa6b7f77d8d153c0bcb?deleteMode=Permissive
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String body Optional. The delete mode. 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
DeleteDiskOfferingAction action = new DeleteDiskOfferingAction();
action.uuid = "1d4e09f16c7c45abaab80be172b26cc1";
action.deleteMode = "Permissive";
action.sessionId = "1a31abeeef7e4ab5bc538168be6deb05";
DeleteDiskOfferingAction.Result res = action.call();
Python SDK
DeleteDiskOfferingAction action = DeleteDiskOfferingAction()
action.uuid = "4f0d2dc3a8f34685ad8543834bf4cfd8"
action.deleteMode = "Permissive"
action.sessionId = "dce93830769b427ca6edf3bda25f65f6"
DeleteDiskOfferingAction.Result res = action.call()

QueryDiskOffering

API Request

URLs
GET zstack/v1/disk-offerings
GET zstack/v1/disk-offerings/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d6550daa638547498b8075f3ebd1e240" \
-X GET http://localhost:8080/zstack/v1/disk-offerings?q=uuid=85c065f24d024bf3920766692da392eb
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3b32284bc5344692a8bc77a43610f460" \
-X GET http://localhost:8080/zstack/v1/disk-offerings/2f25294896e24c89b63edb7a209ebb85

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryDiskOffering, and pressing the Tab key.

API Response

Sample Response
{
"inventories": [
    {
"uuid": "7bd03741125a48d485255601b639318b",
"name": "diskOffering1",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
    }
  ]
}
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
inventories List See inventories. 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
#inventories
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
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
QueryDiskOfferingAction action = new QueryDiskOfferingAction();
action.conditions = asList("uuid=e01b8a266d05425ba2d0c05308763db8");
action.sessionId = "d8a3f3b62d8c4affab7c5d491f95d4de";
QueryDiskOfferingAction.Result res = action.call();
Python SDK
QueryDiskOfferingAction action = QueryDiskOfferingAction()
action.conditions = ["uuid=a1f7f68522e64783a37095a862f9bc28"]
action.sessionId = "593740538236497183e065e1251b6937"
QueryDiskOfferingAction.Result res = action.call()

ChangeDiskOfferingState

API Request

URLs
PUT zstack/v1/disk-offerings/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"changeDiskOfferingState": {
"stateEvent": "enable"
  },
"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 '{"changeDiskOfferingState":{"stateEvent":"enable"}}' \
http://localhost:8080/zstack/v1/disk-offerings/39c32ae614e23ce2a6877797a09037fd/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
stateEvent String body (contained in the changeDiskOfferingState structure) The state event.
  • enable
  • disable
0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
"inventory": {
"uuid": "5e84d8a44b2941eb96d9eec31e0524be",
"name": "diskOffering1",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
  }
}
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 DiskOfferingInventory 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
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
ChangeDiskOfferingStateAction action = new ChangeDiskOfferingStateAction();
action.uuid = "b99744228d4943959881b051cecb376d";
action.stateEvent = "enable";
action.sessionId = "8733eb947ada42bb8769ad170f889e98";
ChangeDiskOfferingStateAction.Result res = action.call();
Python SDK
ChangeDiskOfferingStateAction action = ChangeDiskOfferingStateAction()
action.uuid = "521d538a214c42e39d16cef5a1e13cc9"
action.stateEvent = "enable"
action.sessionId = "7e7ba75914814242a268026ca77163e5"
ChangeDiskOfferingStateAction.Result res = action.call()

UpdateDiskOffering

API Request

URLs
PUT zstack/v1/disk-offerings/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateDiskOffering": {
"name": "new name"
  },
"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 '{"updateDiskOffering":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/disk-offerings/1a2b9698ee163ad69374f765f6234f02/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateDiskOffering structure) Optional. The resource name. 0.6
description String body (contained in the updateDiskOffering structure) Optional. The detailed description of the resource. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
"inventory": {
"uuid": "a156bb54daa544628f2abff419c76977",
"name": "new name",
"diskSize": 100.0,
"state": "Enabled",
"type": "DefaultDiskOfferingType",
"allocatorStrategy": "DefaultPrimaryStorageAllocationStrategy"
  }
}
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 DiskOfferingInventory 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
diskSize Long The volume size. 0.6
sortKey Integer 0.6
state String The state, including Enabled and Disabled. 0.6
type String The type. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
allocatorStrategy String The allocator strategy. 0.6

SDK Sample

Java SDK
UpdateDiskOfferingAction action = new UpdateDiskOfferingAction();
action.uuid = "21226fe14a8042d2ad1d37640c8a8594";
action.name = "new name";
action.sessionId = "c8e71fd622614f15b3452a8fa451d037";
UpdateDiskOfferingAction.Result res = action.call();
Python SDK
UpdateDiskOfferingAction action = UpdateDiskOfferingAction()
action.uuid = "30d4acc261f34c55a297a203fed852e2"
action.name = "new name"
action.sessionId = "0236ee9dd5d440de84f867e9d550172c"
UpdateDiskOfferingAction.Result res = action.call()
API Reference | 5.5.30 | ZStack Cloud · ZCF | ZStack Resource Center