Disk APIs

CreateDataVolume

Create Data Disk

API Request

URLs
POST zstack/v1/volumes/data
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "test-volume",
    "description": "test-data-volume",
    "diskOfferingUuid": "d88594833a393e119c6fc5a8aa2ad08f",
    "diskSize": 0,
    "primaryStorageUuid": "5fe18eef72483c9cbde984a3176fab78",
    "resourceUuid": "52f6075e4d6839fc8a40f569fb7d991e"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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":{"name":"test-volume","description":"test-data-volume","diskOfferingUuid":"d88594833a393e119c6fc5a8aa2ad08f","diskSize":0,"primaryStorageUuid":"5fe18eef72483c9cbde984a3176fab78","resourceUuid":"52f6075e4d6839fc8a40f569fb7d991e"}}' http://localhost:8080/zstack/v1/volumes/data
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Disk name 0.6
description (Optional) String body (included in the params structure) Disk description 0.6
diskOfferingUuid (Optional) String body (included in the params structure) Disk Offering UUID 0.6
primaryStorageUuid (Optional) String body (included in the params structure) Data Storage UUID 0.6
encrypted (Optional) Boolean body (included in the params structure) Whether to create an encrypted disk 5.1.0
resourceUuid (Optional) String body (included in the params structure) Resource UUID 0.6
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6
diskSize (Optional) long body (included in the params structure) Optional. The disk size. 3.4.0

API Response

Response Example
{
  "inventory": {
    "uuid": "35f063bd547030299a4547127a7b676c",
    "name": "test-volume",
    "primaryStorageUuid": "52ddf3a573b23b52812d3f77840d0d83",
    "vmInstanceUuid": "71be0e4c7bd03cda819b12f2b11b7996",
    "diskOfferingUuid": "78d0cde715c5332cabe53e1c934795da",
    "rootImageUuid": "5029547b43e8348aa2efde1ce7d0707d",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-35f063bd547030299a4547127a7b676c/35f063bd547030299a4547127a7b676c.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
CreateDataVolumeAction action = new CreateDataVolumeAction();
action.name = "test-volume";
action.description = "test-data-volume";
action.diskOfferingUuid = "d88594833a393e119c6fc5a8aa2ad08f";
action.diskSize = 0;
action.primaryStorageUuid = "5fe18eef72483c9cbde984a3176fab78";
action.resourceUuid = "52f6075e4d6839fc8a40f569fb7d991e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeAction.Result res = action.call();
Python SDK
action = CreateDataVolumeAction()
action.name = "test-volume"
action.description = "test-data-volume"
action.diskOfferingUuid = "d88594833a393e119c6fc5a8aa2ad08f"
action.diskSize = 0
action.primaryStorageUuid = "5fe18eef72483c9cbde984a3176fab78"
action.resourceUuid = "52f6075e4d6839fc8a40f569fb7d991e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateDataVolumeFromVolumeTemplate

Create Data Disk From Disk Template

API Request

URLs
POST zstack/v1/volumes/data/from/data-volume-templates/{imageUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "data-volume-1",
    "description": "dataVolume-from-volume-template",
    "primaryStorageUuid": "849de664b4db321f8eeef65a1aa757c7",
    "hostUuid": "0de619ae30373e97acc7bb4b42ca87a1"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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":{"name":"data-volume-1","description":"dataVolume-from-volume-template","primaryStorageUuid":"849de664b4db321f8eeef65a1aa757c7","hostUuid":"0de619ae30373e97acc7bb4b42ca87a1"}}' http://localhost:8080/zstack/v1/volumes/data/from/data-volume-templates/285f4a49e7403d2dad9545b42c33b837
Parameter List
Name Type Location Description Allowed Values Starting Version
imageUuid String url Image UUID 0.6
name String body (included in the params structure) Disk name 0.6
description (Optional) String body (included in the params structure) Detailed disk description 0.6
primaryStorageUuid String body (included in the params structure) Data Storage UUID 0.6
hostUuid (Optional) String body (included in the params structure) Host UUID 0.6
encrypted (Optional) Boolean body (included in the params structure) Whether to create an encrypted disk 5.1.0
resourceUuid (Optional) String body (included in the params structure) Optional. The resource UUID. 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4.0

API Response

Response Example
{
  "inventory": {
    "uuid": "c6c15e12c30a3188bc7873da94372eff",
    "name": "test-volume",
    "primaryStorageUuid": "7914e620b7f7392eb9fa0a4d23a4736e",
    "vmInstanceUuid": "a2b18465275139b8b97958bd358e7c6d",
    "diskOfferingUuid": "2bbe96e1a633351ba7b201bd6ccd8184",
    "rootImageUuid": "1360f952d152344088f85f7005985832",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-c6c15e12c30a3188bc7873da94372eff/c6c15e12c30a3188bc7873da94372eff.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
CreateDataVolumeFromVolumeTemplateAction action = new CreateDataVolumeFromVolumeTemplateAction();
action.imageUuid = "285f4a49e7403d2dad9545b42c33b837";
action.name = "data-volume-1";
action.description = "dataVolume-from-volume-template";
action.primaryStorageUuid = "849de664b4db321f8eeef65a1aa757c7";
action.hostUuid = "0de619ae30373e97acc7bb4b42ca87a1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeFromVolumeTemplateAction.Result res = action.call();
Python SDK
action = CreateDataVolumeFromVolumeTemplateAction()
action.imageUuid = "285f4a49e7403d2dad9545b42c33b837"
action.name = "data-volume-1"
action.description = "dataVolume-from-volume-template"
action.primaryStorageUuid = "849de664b4db321f8eeef65a1aa757c7"
action.hostUuid = "0de619ae30373e97acc7bb4b42ca87a1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateDataVolumeFromVolumeSnapshot

Create Data Disk From Disk Snapshot

API Request

URLs
POST zstack/v1/volumes/data/from/volume-snapshots/{volumeSnapshotUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "DataVolume-1",
    "description": "dataVolume-from-snapshot",
    "primaryStorageUuid": "b2237f228a343d0cb8b20b5b64663314"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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":{"name":"DataVolume-1","description":"dataVolume-from-snapshot","primaryStorageUuid":"b2237f228a343d0cb8b20b5b64663314"}}' http://localhost:8080/zstack/v1/volumes/data/from/volume-snapshots/192da9c7d6493a5d9a35d2df2dcc82b0
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Disk name 0.6
description (Optional) String body (included in the params structure) Detailed disk description 0.6
volumeSnapshotUuid String url Disk snapshot UUID 0.6
primaryStorageUuid (Optional) String body (included in the params structure) Data Storage UUID 0.6
resourceUuid (Optional) String body (included in the params structure) Resource UUID 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4.0

API Response

Response Example
{
  "inventory": {
    "uuid": "b4a0e804aa593dc4acb6e88b4924d2a7",
    "name": "test-volume",
    "primaryStorageUuid": "f3bf7c425e7e39d28425b180e162518f",
    "vmInstanceUuid": "b5d31d42533a3a67964b7a09a8a3d0a3",
    "diskOfferingUuid": "200eb910246b32dd854fd76de1a60de8",
    "rootImageUuid": "b09688d2265e381a9362a02d0fab5f61",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-b4a0e804aa593dc4acb6e88b4924d2a7/b4a0e804aa593dc4acb6e88b4924d2a7.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
CreateDataVolumeFromVolumeSnapshotAction action = new CreateDataVolumeFromVolumeSnapshotAction();
action.name = "DataVolume-1";
action.description = "dataVolume-from-snapshot";
action.volumeSnapshotUuid = "192da9c7d6493a5d9a35d2df2dcc82b0";
action.primaryStorageUuid = "b2237f228a343d0cb8b20b5b64663314";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeFromVolumeSnapshotAction.Result res = action.call();
Python SDK
action = CreateDataVolumeFromVolumeSnapshotAction()
action.name = "DataVolume-1"
action.description = "dataVolume-from-snapshot"
action.volumeSnapshotUuid = "192da9c7d6493a5d9a35d2df2dcc82b0"
action.primaryStorageUuid = "b2237f228a343d0cb8b20b5b64663314"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

AttachDataVolumeToVm

Attach Data Disk To Virtual Machine

API Request

URLs
POST zstack/v1/volumes/{volumeUuid}/vm-instances/{vmInstanceUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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/volumes/6fdcff5868fe376a98359eba8b3d0efe/vm-instances/f6abc3b26ffe337ba61dd7298fb0b9df
Parameter List
Name Type Location Description Allowed Values Starting Version
vmInstanceUuid String url Virtual Machine UUID 0.6
volumeUuid String url Disk UUID 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "8476e080a92e3c6f84627c6a86bfae08",
    "name": "test-volume",
    "primaryStorageUuid": "1c25ebdcdb6a3b7e8f891f9f9ba8e740",
    "vmInstanceUuid": "8de5cd9e5a2139f8b0ee5b6ca697f630",
    "diskOfferingUuid": "ebd55ac451fc364483efded09c72d348",
    "rootImageUuid": "ae2ecb59af10319494b77e142bf009b3",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-8476e080a92e3c6f84627c6a86bfae08/8476e080a92e3c6f84627c6a86bfae08.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
AttachDataVolumeToVmAction action = new AttachDataVolumeToVmAction();
action.vmInstanceUuid = "f6abc3b26ffe337ba61dd7298fb0b9df";
action.volumeUuid = "6fdcff5868fe376a98359eba8b3d0efe";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachDataVolumeToVmAction.Result res = action.call();
Python SDK
action = AttachDataVolumeToVmAction()
action.vmInstanceUuid = "f6abc3b26ffe337ba61dd7298fb0b9df"
action.volumeUuid = "6fdcff5868fe376a98359eba8b3d0efe"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DetachDataVolumeFromVm

Detach Data Disk From Virtual Machine

API Request

URLs
DELETE zstack/v1/volumes/{uuid}/vm-instances
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X DELETE http://localhost:8080/zstack/v1/volumes/f86fef130e1632a0873f6d3db1ca2b91/vm-instances?vmUuid=88d866d0c5ec303cb55cf4d4077f1987
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk UUID, which uniquely identifies the resource 0.6
vmUuid (Optional) String query Virtual machine UUID 0.6
systemTags (Optional) List query Optional. The system tags. 0.6
userTags (Optional) List query User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "13c852f93e893c0ebaee534f765d8020",
    "name": "test-volume",
    "primaryStorageUuid": "4ecbb189079030f7bd0c4540a12131e0",
    "vmInstanceUuid": "852244e0057032f9a4e4773062117ff5",
    "diskOfferingUuid": "c91ad931a7893e3088e45d5343a394ef",
    "rootImageUuid": "f8d3536a850e3f8b939dc8381c6a1692",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-13c852f93e893c0ebaee534f765d8020/13c852f93e893c0ebaee534f765d8020.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
DetachDataVolumeFromVmAction action = new DetachDataVolumeFromVmAction();
action.uuid = "f86fef130e1632a0873f6d3db1ca2b91";
action.vmUuid = "88d866d0c5ec303cb55cf4d4077f1987";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachDataVolumeFromVmAction.Result res = action.call();
Python SDK
action = DetachDataVolumeFromVmAction()
action.uuid = "f86fef130e1632a0873f6d3db1ca2b91"
action.vmUuid = "88d866d0c5ec303cb55cf4d4077f1987"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangeVolumeState

Change Disk State

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeVolumeState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"changeVolumeState":{"stateEvent":"enable"}}' http://localhost:8080/zstack/v1/volumes/97fa26ec14d9328c9cfada75e3c0307b/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk resource UUID 0.6
stateEvent String body (included in the changeVolumeState structure) Enable or disable
  • enable
  • disable
0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "2abdbbf661253f9e9438f5af185b0ad0",
    "name": "test-volume",
    "primaryStorageUuid": "e7a19eb3078b3de289cd2a5aa9cfbdfc",
    "vmInstanceUuid": "2df5db71b12b3d7b9df3b3c900db964f",
    "diskOfferingUuid": "894513d30e093ca18e61e9d6c864552c",
    "rootImageUuid": "98046b09102e302eaa7345c233065cd1",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-2abdbbf661253f9e9438f5af185b0ad0/2abdbbf661253f9e9438f5af185b0ad0.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
ChangeVolumeStateAction action = new ChangeVolumeStateAction();
action.uuid = "97fa26ec14d9328c9cfada75e3c0307b";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVolumeStateAction.Result res = action.call();
Python SDK
action = ChangeVolumeStateAction()
action.uuid = "97fa26ec14d9328c9cfada75e3c0307b"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateVolume

Update Disk

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateVolume": {
    "name": "volume-1",
    "description": "data-volume"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"updateVolume":{"name":"volume-1","description":"data-volume"}}' http://localhost:8080/zstack/v1/volumes/f1eddfdb19ad3a0881b0be863901ff09/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk UUID, which uniquely identifies the resource 0.6
name (Optional) String body (included in the updateVolume structure) Disk name 0.6
description (Optional) String body (included in the updateVolume structure) Detailed disk description 0.6
systemTags (Optional) List body System tags 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "9ad8111dec96322d813cc2783408392f",
    "name": "test-volume",
    "primaryStorageUuid": "a5825e8187f03a318572c11b2b9b046d",
    "vmInstanceUuid": "4f35f03f5be0317bb9c682fcafedec9e",
    "diskOfferingUuid": "b0b42031ee1833778744ef67283338e9",
    "rootImageUuid": "6bfe2461fb333ca8b0d76385652343af",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-9ad8111dec96322d813cc2783408392f/9ad8111dec96322d813cc2783408392f.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
UpdateVolumeAction action = new UpdateVolumeAction();
action.uuid = "f1eddfdb19ad3a0881b0be863901ff09";
action.name = "volume-1";
action.description = "data-volume";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateVolumeAction.Result res = action.call();
Python SDK
action = UpdateVolumeAction()
action.uuid = "f1eddfdb19ad3a0881b0be863901ff09"
action.name = "volume-1"
action.description = "data-volume"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryVolume

Query Disk

API Request

URLs
GET zstack/v1/volumes
GET zstack/v1/volumes/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/volumes?
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/volumes/734f1106137b37e3b5876e9b836e9774

Queryable Fields

Run the CLI tool and enter QueryVolume, and press Tab to view all queryable fields and the names of resources available for cross-table queries.

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "a66cd4f1ac2b3fa0855b8b5e91798178",
      "name": "test-volume",
      "primaryStorageUuid": "9ef9f24c513e367285a7119c42561a53",
      "vmInstanceUuid": "b2b98398b49e3fbfa59d24c0b6a9a947",
      "diskOfferingUuid": "c9ff1c6960323e3a930842b1aa4f4212",
      "rootImageUuid": "c8b688328aa335d0bb5f11f6eb6dd6bc",
      "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-a66cd4f1ac2b3fa0855b8b5e91798178/a66cd4f1ac2b3fa0855b8b5e91798178.qcow2",
      "type": "Root",
      "format": "qcow2",
      "size": 107374182400,
      "actualSize": 21474836480,
      "deviceId": 0,
      "state": "Enabled",
      "status": "Ready",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventories List For details, see inventories 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventories
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
QueryVolumeAction action = new QueryVolumeAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVolumeAction.Result res = action.call();
Python SDK
action = QueryVolumeAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ResizeDataVolume

Resize Data Disk

API Request

URLs
PUT zstack/v1/volumes/data/resize/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "resizeDataVolume": {
    "size": 10000000
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"resizeDataVolume":{"size":10000000}}' http://localhost:8080/zstack/v1/volumes/data/resize/6c2a13e8d7fa3ef99091bc6a445d4e9c/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Resource UUID, which uniquely identifies the resource 2.2
size long body (included in the resizeDataVolume structure) Size after expansion 2.2
systemTags (Optional) List body System tags 2.2
userTags (Optional) List body User tags 2.2

API Response

Response Example
{
  "inventory": {
    "uuid": "f17a01d17e4d39bdb17d227a1df97e3a",
    "name": "test-volume",
    "primaryStorageUuid": "83245aa16d02322785f84450d1a05441",
    "vmInstanceUuid": "14ca01538ffa3ab49aad3dd60c4c41b4",
    "diskOfferingUuid": "9dd65df23d453f25855a2c2b2f9f778b",
    "rootImageUuid": "825ca3ebcb053abf843ed8b2731ec4b9",
    "installPath": "/zstack_ps/dataVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-f17a01d17e4d39bdb17d227a1df97e3a/f17a01d17e4d39bdb17d227a1df97e3a.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
ResizeDataVolumeAction action = new ResizeDataVolumeAction();
action.uuid = "6c2a13e8d7fa3ef99091bc6a445d4e9c";
action.size = 10000000;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ResizeDataVolumeAction.Result res = action.call();
Python SDK
action = ResizeDataVolumeAction()
action.uuid = "6c2a13e8d7fa3ef99091bc6a445d4e9c"
action.size = 10000000
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ResizeRootVolume

Resize Root Disk

API Request

URLs
PUT zstack/v1/volumes/resize/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "resizeRootVolume": {
    "size": 10000000
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"resizeRootVolume":{"size":10000000}}' http://localhost:8080/zstack/v1/volumes/resize/16a052d270983392bd2824c06a44253f/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid (Optional) String url Resource UUID, which uniquely identifies the resource 0.6
size long body (included in the resizeRootVolume structure) Size after expansion 0.6
systemTags (Optional) List body Optional. The system tags. 0.6
userTags (Optional) List body Optional. The user tags. 0.6
vmInstanceUuid (Optional) String body (included in the resizeRootVolume structure) Virtual Machine UUID 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "fc005064ec293934bfb3f0263189de68",
    "name": "test-volume",
    "primaryStorageUuid": "f9c7c967f9fb38839b9f115283fdfbd2",
    "vmInstanceUuid": "927c1d13b9e8382cb8f548571a416c21",
    "diskOfferingUuid": "250ba8e5379930daab16bcd8bf44d04b",
    "rootImageUuid": "ffcedb51196c370dac87dce89cd78e94",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-fc005064ec293934bfb3f0263189de68/fc005064ec293934bfb3f0263189de68.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
ResizeRootVolumeAction action = new ResizeRootVolumeAction();
action.uuid = "16a052d270983392bd2824c06a44253f";
action.size = 10000000;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ResizeRootVolumeAction.Result res = action.call();
Python SDK
action = ResizeRootVolumeAction()
action.uuid = "16a052d270983392bd2824c06a44253f"
action.size = 10000000
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SetVolumeQos

Set Disk Qos

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "setVolumeQos": {
    "totalBandwidth": 10000,
    "totalIOPS": 1000
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"setVolumeQos":{"totalBandwidth":10000,"totalIOPS":1000}}' http://localhost:8080/zstack/v1/volumes/384f99ce0b7a307685856b23f75c5167/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk UUID 3.1.0
volumeBandwidth (Optional) Long body (included in the setVolumeQos structure) Disk bandwidth limit 3.1.0
systemTags (Optional) List body Optional. The system tags. 3.1.0
userTags (Optional) List body Optional. The user tags. 3.1.0
mode (Optional) String body (included in the setVolumeQos structure) Optional. The mode.
  • total
  • read
  • write
3.1.0
readBandwidth (Optional) Long body (included in the setVolumeQos structure) Optional. The read bandwidth. 3.14.0
writeBandwidth (Optional) Long body (included in the setVolumeQos structure) Optional. The write bandwidth. 3.14.0
totalBandwidth (Optional) Long body (included in the setVolumeQos structure) Optional. The total bandwidth. 3.14.0
readIOPS (Optional) Long body (included in the setVolumeQos structure) Optional. The read iops. 3.14.0
writeIOPS (Optional) Long body (included in the setVolumeQos structure) Optional. The write iops. 3.14.0
totalIOPS (Optional) Long body (included in the setVolumeQos structure) Optional. The total iops. 3.14.0

API Response

Response Example
{
  "inventory": {
    "uuid": "6e9ee53ebad936da8a8d5d2741108a75",
    "name": "volume",
    "primaryStorageUuid": "630a2901d3083328a04333ca9e1330c0",
    "vmInstanceUuid": "042bfcd0830731d78f35598541b8de48",
    "diskOfferingUuid": "31294bcbedf53971bd71c2f247e0f9fc",
    "rootImageUuid": "0bc2f95ef0fb3785936d02ea58fd2e02",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/inventory-6e9ee53ebad936da8a8d5d2741108a75/6e9ee53ebad936da8a8d5d2741108a75.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "volumeQos": "total\u003d20971520"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 3.1.0
inventory VolumeInventory For details, see inventory 3.1.0
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.1.0
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6

SDK Examples

Java SDK
SetVolumeQosAction action = new SetVolumeQosAction();
action.uuid = "384f99ce0b7a307685856b23f75c5167";
action.totalBandwidth = 10000;
action.totalIOPS = 1000;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVolumeQosAction.Result res = action.call();
Python SDK
action = SetVolumeQosAction()
action.uuid = "384f99ce0b7a307685856b23f75c5167"
action.totalBandwidth = 10000
action.totalIOPS = 1000
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SyncVolumeSize

Sync Disk Size

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncVolumeSize": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"syncVolumeSize":{}}' http://localhost:8080/zstack/v1/volumes/017a6c821b3433c594285712cd7e69f4/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk UUID, which uniquely identifies the resource 0.6
systemTags (Optional) List body Optional. The system tags. 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "0de2e5ea43b539479b6e9add80b4a993",
    "name": "test-volume",
    "primaryStorageUuid": "61676be9b012303686d8565dce039e01",
    "vmInstanceUuid": "e9603db499f6357d9de6c03af2017b3d",
    "diskOfferingUuid": "6b5132d5bf01385e8888c3d98b2139c9",
    "rootImageUuid": "5086350485c532218fa1e1c32b88827d",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-0de2e5ea43b539479b6e9add80b4a993/0de2e5ea43b539479b6e9add80b4a993.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
SyncVolumeSizeAction action = new SyncVolumeSizeAction();
action.uuid = "017a6c821b3433c594285712cd7e69f4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVolumeSizeAction.Result res = action.call();
Python SDK
action = SyncVolumeSizeAction()
action.uuid = "017a6c821b3433c594285712cd7e69f4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RecoverDataVolume

Recover Data Disk

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "recoverDataVolume": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"recoverDataVolume":{}}' http://localhost:8080/zstack/v1/volumes/9f5090fc93ff33e283e0ff3c99fad1e2/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Disk UUID, which uniquely identifies the resource 0.6
systemTags (Optional) List body Optional. The system tags. 0.6
userTags (Optional) List body User tags 0.6

API Response

Response Example
{
  "inventory": {
    "uuid": "81408dab76543096930e9ac798f20c8a",
    "name": "test-volume",
    "primaryStorageUuid": "a513990b7a4036b78a1ef7b943ccfdbd",
    "vmInstanceUuid": "9454b675de203c0a8a3148dd8b8e8ce0",
    "diskOfferingUuid": "39b3b8963ec1304ba9b173995867b016",
    "rootImageUuid": "515d16fefeb5322580f46521aade4551",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-81408dab76543096930e9ac798f20c8a/81408dab76543096930e9ac798f20c8a.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VolumeInventory For details, see inventory 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0

SDK Examples

Java SDK
RecoverDataVolumeAction action = new RecoverDataVolumeAction();
action.uuid = "9f5090fc93ff33e283e0ff3c99fad1e2";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverDataVolumeAction.Result res = action.call();
Python SDK
action = RecoverDataVolumeAction()
action.uuid = "9f5090fc93ff33e283e0ff3c99fad1e2"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

FlattenVolume

Flatten Disk

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "flattenVolume": {
    "dryRun": false
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"flattenVolume":{"dryRun":false}}' http://localhost:8080/zstack/v1/volumes/df7876b9124d3fcb92528cf774fa6de1/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Resource UUID, which uniquely identifies the resource 3.17.0
dryRun (Optional) boolean body (included in the flattenVolume structure) Dry run, which can be used to predict data usage 3.17.0
systemTags (Optional) List body System tags 3.17.0
userTags (Optional) List body User tags 3.17.0

API Response

Response Example
{
  "inventory": {
    "uuid": "13ff90c5fcd43587915817a65cc87af3",
    "name": "test-volume",
    "primaryStorageUuid": "55db0399efaf35479125967b5bd6e8c7",
    "vmInstanceUuid": "c3f9c1907206307a896db9a94a35c29d",
    "diskOfferingUuid": "d4d9b3afe4993bfbba991b4414295a65",
    "rootImageUuid": "7bcdd79e0ed1347f9a2d4ea043bb9f37",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-13ff90c5fcd43587915817a65cc87af3/13ff90c5fcd43587915817a65cc87af3.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the request succeeded 3.17.0
inventory VolumeInventory For details, see inventory 3.17.0
error ErrorCode For details, see error 3.17.0
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6

SDK Examples

Java SDK
FlattenVolumeAction action = new FlattenVolumeAction();
action.uuid = "df7876b9124d3fcb92528cf774fa6de1";
action.dryRun = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
FlattenVolumeAction.Result res = action.call();
Python SDK
action = FlattenVolumeAction()
action.uuid = "df7876b9124d3fcb92528cf774fa6de1"
action.dryRun = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangeVolumeEncryption

Change Disk Encryption

API Request

URLs
PUT zstack/v1/volumes/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeVolumeEncryption": {
    "encrypted": true
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown 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 PUT -d '{"changeVolumeEncryption":{"encrypted":true}}' http://localhost:8080/zstack/v1/volumes/46afde2b3d9838c888ebfa821e5c3e43/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Resource UUID, which uniquely identifies the resource 5.1.0
encrypted boolean body (included in the changeVolumeEncryption structure) Whether the resource is encrypted. 5.1.0
systemTags (Optional) List body System tags 5.1.0
userTags (Optional) List body User tags 5.1.0

API Response

Response Example
{
  "inventory": {
    "uuid": "ff0eb5a723e9316bb1053ed7e4bb3100",
    "name": "test-volume",
    "primaryStorageUuid": "ff0359abb8443d2f8077cc368afa7c00",
    "vmInstanceUuid": "ff01ec80fd11327cba7519b66119d900",
    "diskOfferingUuid": "ff08f99cf0213becb76cb9cbd4e7d900",
    "rootImageUuid": "ff0d8d59fa8b3afeaae58282fe49fa00",
    "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-ff0eb5a723e9316bb1053ed7e4bb3100/ff0eb5a723e9316bb1053ed7e4bb3100.qcow2",
    "type": "Root",
    "format": "qcow2",
    "size": 107374182400,
    "actualSize": 21474836480,
    "deviceId": 0,
    "state": "Enabled",
    "status": "Ready",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "encrypted": true
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 5.1.0
inventory VolumeInventory For details, see inventory 5.1.0
error ErrorCode For details, see error 5.1.0
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6

SDK Examples

Java SDK
ChangeVolumeEncryptionAction action = new ChangeVolumeEncryptionAction();
action.uuid = "46afde2b3d9838c888ebfa821e5c3e43";
action.encrypted = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVolumeEncryptionAction.Result res = action.call();
Python SDK
action = ChangeVolumeEncryptionAction()
action.uuid = "46afde2b3d9838c888ebfa821e5c3e43"
action.encrypted = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center