Backup Service (Plus)
The Backup Service feature is provided in a separate module. Before you can use this feature, you need to purchase the Plus License of Backup Service, in addition to the Base License.
Backup Service Operations
CreateVolumeBackup
API Request
POST zstack/v1/volumes/{volumeUuid}/volume-backupsAuthorization: OAuth the-session-uuid{
"params": {
"backupStorageUuid": "1c4b0a3a24533c4faa9b156a0ef98fdf",
"name": "backup-1",
"description": "a critical volume backup"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"1c4b0a3a24533c4faa9b156a0ef98fdf","name":"backup-1","description":"a critical volume backup"}}' http://localhost:8080/zstack/v1/volumes/ec7196ba2d993236aceddd9b31f5d19b/volume-backups| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| volumeUuid | String | body (contained in the params structure) | The UUID of the volume. | 2.6.0 | |
| backupStorageUuid | String | body (contained in the params structure) | The UUID of the backup storage. | 2.6.0 | |
| name | String | body (contained in the params structure) | The name of the backup. | 2.6.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the backup. | 2.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. Specify a UUID of the backup. | 2.6.0 | |
| volumeReadBandwidth | Long | body (contained in the params structure) | Optional. The maximum speed at which data from the volume is read. | 3.1.0 | |
| volumeWriteBandwidth | Long | body (contained in the params structure) | Optional. The maximum speed at which data is written to the volume. | 3.1.0 | |
| networkReadBandwidth | Long | body (contained in the params structure) | Optional. The network bandwidth for data reads. | 3.1.0 | |
| networkWriteBandwidth | Long | body (contained in the params structure) | Optional. The network bandwidth for data writes. | 3.1.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 |
Note:
- When you create a volume backup in ZStack Cloud, the data of the volume in a host will be
backed up to an ImageStore backup storage. Note that the data exchange
in this process will use the backup network. You can add the
backupnetwork option to SystemTags.
- Format of the backupnetwork option:
backup::network::cidr::CIDR - Example:
backup::network::cidr::10.0.0.0/8
- Format of the backupnetwork option:
- When you create a volume backup in ZStack Cloud, you can specify how to back up the volume data to the backup storage by adding the fsInfo option to SystemTags.
-
- Format of the fsInfo option:
fsInfo::type::$TYPE::url::$URL::options::$OPTIONS - Example:
fsInfo::type::nfs::url::172.32.1.119:/nas/nfs2::options::nolock,vers=3,rsize=32768,wsize=32768
- Format of the fsInfo option:
- When you create a volume backup in ZStack Cloud,
you can configure the concurrency level for the volume backup by adding
the volumeLiveBackup option to SystemTags.
- Format of the volumeLiveBackup option:
volumeLiveBackup::parallelismDegree::$NUMBER - Example:
volumeLiveBackup::parallelismDegree::1
- Format of the volumeLiveBackup option:
API Response
{
"inventory": {
"uuid": "6bd6608ecda63747b2471a02b42704d6",
"volumeUuid": "1a0c6b2ca31a3b40b2c06a0f2ecb0849",
"name": "Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 2.6.0 |
| inventory | VolumeBackupInventory | See inventory | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 2.6.0 |
| volumeUuid | String | The UUID of the volume. | 2.6.0 |
| name | String | The name of the volume backup. | 2.6.0 |
| description | String | The detailed description of the backup. | 2.6.0 |
| type | String | The type of the volume. | 2.6.0 |
| state | String | The status of the backup. | 2.6.0 |
| status | String | The availability status of the backup. | 2.6.0 |
| size | Long | The size of the backup. | 2.6.0 |
| metadata | String | The metadata of the backup. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | The storage path of the backup. | 2.6.0 |
| status | String | The status of the backup in the backup storage. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
SDK Sample
CreateVolumeBackupAction action = new CreateVolumeBackupAction();
action.volumeUuid = "ec7196ba2d993236aceddd9b31f5d19b";
action.backupStorageUuid = "1c4b0a3a24533c4faa9b156a0ef98fdf";
action.name = "backup-1";
action.description = "a critical volume backup";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVolumeBackupAction.Result res = action.call();CreateVolumeBackupAction action = CreateVolumeBackupAction()
action.volumeUuid = "ec7196ba2d993236aceddd9b31f5d19b"
action.backupStorageUuid = "1c4b0a3a24533c4faa9b156a0ef98fdf"
action.name = "backup-1"
action.description = "a critical volume backup"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVolumeBackupAction.Result res = action.call()DeleteVolumeBackup
API Request
DELETE zstack/v1/volume-backups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/volume-backups/e95ef48f7cc6396f8e025fd5e38ebccb| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| backupStorageUuids | List | url | Optional. The UUIDs of the backup storage. | 2.6.0 | |
| deleteMode | String | url | Optional. The mode under which the backup is deleted. | 2.6.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 | |
| handleDependency | boolean | body | Optional. whether to handle dependency when deleting volume backup. | 4.7.11 |
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
DeleteVolumeBackupAction action = new DeleteVolumeBackupAction();
action.uuid = "e95ef48f7cc6396f8e025fd5e38ebccb";
action.backupStorageUuids = asList("6cfa909085e13160825db03bcd664ff2");
action.handleDependency = false;
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVolumeBackupAction.Result res = action.call();DeleteVolumeBackupAction action = DeleteVolumeBackupAction()
action.uuid = "e95ef48f7cc6396f8e025fd5e38ebccb"
action.backupStorageUuids = [6cfa909085e13160825db03bcd664ff2]
action.handleDependency = false
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVolumeBackupAction.Result res = action.call()QueryVolumeBackup
API Request
GET zstack/v1/volume-backups
GET zstack/v1/volume-backups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/volume-backups?q=uuid=12d9162338f637c2855f58b63a7f19d5curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/volume-backups/09de4206bb143d75aad644c88cdbb364Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryVolumeBackup, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "aaf2564bbbed3eab97b7ecff370d8ff1",
"volumeUuid": "92dcb8125f7b3187887e2abc8532b749",
"name": "backup-2",
"description": "my backup",
"size": 1310720.0
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 2.6.0 |
| inventories | List | See inventories | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 2.6.0 |
| volumeUuid | String | The UUID of the volume. | 2.6.0 |
| name | String | The name of the backup. | 2.6.0 |
| description | String | The detailed description of the backup. | 2.6.0 |
| type | String | The type of the volume. | 2.6.0 |
| state | String | The status of the backup. | 2.6.0 |
| status | String | The availability status of the backup. | 2.6.0 |
| size | Long | The size of the backup. | 2.6.0 |
| metadata | String | The metadata of the backup. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | The storage path of the backup. | 2.6.0 |
| status | String | The status of the backup in the backup storage. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
SDK Sample
QueryVolumeBackupAction action = new QueryVolumeBackupAction();
action.conditions = asList("uuid=031d210f004e31529b7ae7beb73c8bb9");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVolumeBackupAction.Result res = action.call();QueryVolumeBackupAction action = QueryVolumeBackupAction()
action.conditions = ["uuid=4ec7c280156635b1a8164d6c9e455b41"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryVolumeBackupAction.Result res = action.call()CreateDataVolumeTemplateFromVolumeBackup
API Request
POST zstack/v1/images/data-volume-templates/from/volume-template/{backupUuid}Authorization: OAuth the-session-uuid{
"params": {
"backupStorageUuid": "030d573ce5f33ab1b53524f8bef1c2cd",
"name": "template",
"description": "data template from volume backup",
"system": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"030d573ce5f33ab1b53524f8bef1c2cd","name":"template","description":"data template from volume backup","system":false}}' http://localhost:8080/zstack/v1/images/data-volume-templates/from/volume-template/2832c8cc11303003ad248eac940ed06c| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| backupUuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| backupStorageUuid | String | body (contained in the params structure) | The UUID of the backup storage. | 2.6.0 | |
| name | String | body (contained in the params structure) | The name of the volume image. | 2.6.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the volume image. | 2.6.0 | |
| guestOsType | String | body (contained in the params structure) | Optional. The type of the guest operating system. | 2.6.0 | |
| platform | String | body (contained in the params structure) | Optional. The platform type of the guest. |
|
2.6.0 |
| system | boolean | body (contained in the params structure) | Optional. Specify whether to create a system image. | 2.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. Specify a UUID for the image. | 2.6.0 | |
| architecture | String | body (contained in the params structure) | Optional. |
|
4.0.0 |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 |
API Response
{
"inventory": {
"uuid": "fb4415140ff4329f8b7b42f01f04cfdb",
"name": "My Volume Template",
"mediaType": "DataVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "fb4415140ff4329f8b7b42f01f04cfdb",
"backupStorageUuid": "ccc3d837be813722bfa59e0a259ada0e",
"installPath": "zstore://mydata/0cd599ec159249489475112a058bb93a",
"status": "Ready"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 2.6.0 |
| inventory | ImageInventory | See inventory | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume image. | 2.6.0 |
| name | String | The name of the volume image. | 2.6.0 |
| description | String | The detailed description of the volume image. | 2.6.0 |
| state | String | 2.6.0 | |
| status | String | 2.6.0 | |
| size | Long | 2.6.0 | |
| actualSize | Long | 2.6.0 | |
| md5Sum | String | 2.6.0 | |
| url | String | 2.6.0 | |
| mediaType | String | 2.6.0 | |
| guestOsType | String | 2.6.0 | |
| type | String | 2.6.0 | |
| platform | String | 2.6.0 | |
| format | String | 2.6.0 | |
| system | Boolean | 2.6.0 | |
| createDate | Timestamp | The time when the volume image was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the volume image was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The UUID of the volume image. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | 2.6.0 | |
| exportUrl | String | 2.6.0 | |
| exportMd5Sum | String | 2.6.0 | |
| status | String | 2.6.0 | |
| createDate | Timestamp | The time when the volume image was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the volume image was last modified. | 2.6.0 |
SDK Sample
CreateDataVolumeTemplateFromVolumeBackupAction action = new CreateDataVolumeTemplateFromVolumeBackupAction();
action.backupUuid = "2832c8cc11303003ad248eac940ed06c";
action.backupStorageUuid = "030d573ce5f33ab1b53524f8bef1c2cd";
action.name = "template";
action.description = "data template from volume backup";
action.system = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeTemplateFromVolumeBackupAction.Result res = action.call();CreateDataVolumeTemplateFromVolumeBackupAction action = CreateDataVolumeTemplateFromVolumeBackupAction()
action.backupUuid = "2832c8cc11303003ad248eac940ed06c"
action.backupStorageUuid = "030d573ce5f33ab1b53524f8bef1c2cd"
action.name = "template"
action.description = "data template from volume backup"
action.system = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDataVolumeTemplateFromVolumeBackupAction.Result res = action.call()CreateRootVolumeTemplateFromVolumeBackup
API Request
POST zstack/v1/images/root-volume-templates/from/volume-template/{backupUuid}Authorization: OAuth the-session-uuid{
"params": {
"backupStorageUuid": "9681bf8631a133ccb84fc5cf6ff7aaa6",
"name": "template",
"description": "root template from volume backup",
"system": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"9681bf8631a133ccb84fc5cf6ff7aaa6","name":"template","description":"root template from volume backup","system":false}}' http://localhost:8080/zstack/v1/images/root-volume-templates/from/volume-template/84eccd458028338d8f5eb72efdc6f8a7| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| backupUuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| backupStorageUuid | String | body (contained in the params structure) | The UUID of the backup storage. | 2.6.0 | |
| name | String | body (contained in the params structure) | The name of the root volume image. | 2.6.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the image. | 2.6.0 | |
| guestOsType | String | body (contained in the params structure) | Optional. The type of the guest operating system. | 2.6.0 | |
| platform | String | body (contained in the params structure) | Optional. The platform type of the guest. |
|
2.6.0 |
| system | boolean | body (contained in the params structure) | Optional. Specify whether to create a system image. | 2.6.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. Specify a UUID for the image. | 2.6.0 | |
| architecture | String | body (contained in the params structure) | Optional. |
|
4.0.0 |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 |
API Response
{
"inventory": {
"uuid": "e2b2695d55243c2997b5dc6165fffa83",
"name": "My Volume Template",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "e2b2695d55243c2997b5dc6165fffa83",
"backupStorageUuid": "4ed18086e5593b86932436d02f575213",
"installPath": "zstore://centos/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 2.6.0 |
| inventory | ImageInventory | See inventory | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the root volume image. | 2.6.0 |
| name | String | The name of the image. | 2.6.0 |
| description | String | The detailed description of the image. | 2.6.0 |
| state | String | The state of the image. | 4.0.0 |
| status | String | The readiness of the image. | 4.0.0 |
| size | Long | The size of the image. | 4.0.0 |
| actualSize | Long | The actual storage space used by the image. | 4.0.0 |
| md5Sum | String | The MD5 value of the image. | 4.0.0 |
| url | String | The URL of the image. | 4.0.0 |
| mediaType | String | The type of the image. | 4.0.0 |
| guestOsType | String | The type of the guest OS. | 4.0.0 |
| type | String | The interval used field. | 4.0.0 |
| platform | String | The system platform of the image. | 4.0.0 |
| format | String | The format of the image, for example, raw. | 4.0.0 |
| system | Boolean | Specifies whether the image is a system image. | 4.0.0 |
| createDate | Timestamp | The time when the image was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the image was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | The UUID of the root volume image. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | The installation path of the image on the backup storage. | 4.0.0 |
| exportUrl | String | The exported URL of the image. | 4.0.0 |
| exportMd5Sum | String | The MD5 value of the exported image. | 4.0.0 |
| status | String | The readiness of the image. | 4.0.0 |
| createDate | Timestamp | The time when the image was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the image was last modified. | 2.6.0 |
SDK Sample
CreateRootVolumeTemplateFromVolumeBackupAction action = new CreateRootVolumeTemplateFromVolumeBackupAction();
action.backupUuid = "84eccd458028338d8f5eb72efdc6f8a7";
action.backupStorageUuid = "9681bf8631a133ccb84fc5cf6ff7aaa6";
action.name = "template";
action.description = "root template from volume backup";
action.system = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateRootVolumeTemplateFromVolumeBackupAction.Result res = action.call();CreateRootVolumeTemplateFromVolumeBackupAction action = CreateRootVolumeTemplateFromVolumeBackupAction()
action.backupUuid = "84eccd458028338d8f5eb72efdc6f8a7"
action.backupStorageUuid = "9681bf8631a133ccb84fc5cf6ff7aaa6"
action.name = "template"
action.description = "root template from volume backup"
action.system = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateRootVolumeTemplateFromVolumeBackupAction.Result res = action.call()SyncVolumeBackup
API Request
PUT zstack/v1/volume-backups/imageStore/{imageStoreUuid}/actionsAuthorization: OAuth the-session-uuid{
"syncVolumeBackup": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncVolumeBackup":{}}' http://localhost:8080/zstack/v1/volume-backups/imageStore/d84c15efe2e941e38d090299bb5b498c/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| imageStoreUuid | String | url | The UUID of the backup storage. | 3.5.0 | |
| systemTags | List | body | 3.5.0 | ||
| userTags | List | body | 3.5.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
SyncVolumeBackupAction action = new SyncVolumeBackupAction();
action.imageStoreUuid = "90658f04b39d40369593a7e56ab62e15";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVolumeBackupAction.Result res = action.call();SyncVolumeBackupAction action = SyncVolumeBackupAction()
action.imageStoreUuid = "91570173248a40d7a02e3905e50c7ad6"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncVolumeBackupAction.Result res = action.call()RevertVolumeFromVolumeBackup
API Request
PUT zstack/v1/volume-backups/{uuid}/actions?卷备份uuid={volume backup uuid}Authorization: OAuth the-session-uuid{
"revertVolumeFromVolumeBackup": {
"backupStrogeUuid": "7031eaf192333f52a0cd889327d5a0de"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revertVolumeFromVolumeBackup":{"backupStrogeUuid":"7031eaf192333f52a0cd889327d5a0de"}}' http://localhost:8080/zstack/v1/volume-backups/b3f89ba2d4173bc5864d1b0d19e93f22/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| 卷备份uuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| backupStrogeUuid | String | body (contained in the revertVolumeFromVolumeBackup structure) | Optional. The UUID of the backup storage. | 2.6.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 |
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
RevertVolumeFromVolumeBackupAction action = new RevertVolumeFromVolumeBackupAction();
action.uuid = "b3f89ba2d4173bc5864d1b0d19e93f22";
action.backupStrogeUuid = "7031eaf192333f52a0cd889327d5a0de";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevertVolumeFromVolumeBackupAction.Result res = action.call();RevertVolumeFromVolumeBackupAction action = RevertVolumeFromVolumeBackupAction()
action.uuid = "b3f89ba2d4173bc5864d1b0d19e93f22"
action.backupStrogeUuid = "7031eaf192333f52a0cd889327d5a0de"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevertVolumeFromVolumeBackupAction.Result res = action.call()RecoverBackupFromImageStoreBackupStorage
API Request
PUT zstack/v1/volume-backups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"recoverBackupFromImageStoreBackupStorage": {
"srcBackupStorageUuid": "cdd6242179f037c3a2c4cd1d17678f36",
"dstBackupStorageUuid": "eebba83336ac34938e5a6e6db30d5eb8"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"cdd6242179f037c3a2c4cd1d17678f36","dstBackupStorageUuid":"eebba83336ac34938e5a6e6db30d5eb8"}}' \
http://localhost:8080/zstack/v1/volume-backups/4c047b04165e3c8ca2b4859ddf41d882/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| srcBackupStorageUuid | String | body (contained in the recoverBackupFromImageStoreBackupStorage structure) | The UUID of the source backup storage. | 2.6.0 | |
| dstBackupStorageUuid | String | body (contained in the recoverBackupFromImageStoreBackupStorage structure) | The UUID of the destination backup storage. | 2.6.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The system tags. | 2.6.0 |
API Response
{
"inventory": {
"uuid": "db84847f4bd13c3399a45241a722ce80",
"volumeUuid": "b91250390732348689211459223892f0",
"name": "Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 2.6.0 |
| inventory | VolumeBackupInventory | See inventory | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 2.6.0 |
| volumeUuid | String | The UUID of the volume. | 2.6.0 |
| name | String | The name of the volume backup. | 2.6.0 |
| description | String | The detailed description of the backup. | 2.6.0 |
| type | String | The type of the volume. | 2.6.0 |
| state | String | The status of the backup. | 2.6.0 |
| status | String | The availability status of the backup. | 2.6.0 |
| size | Long | The size of the backup. | 2.6.0 |
| metadata | String | The metadata of the backup. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | The storage path of the backup. | 2.6.0 |
| status | String | The status of the backup in the backup storage. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
SDK Sample
RecoverBackupFromImageStoreBackupStorageAction action = new RecoverBackupFromImageStoreBackupStorageAction();
action.uuid = "4c047b04165e3c8ca2b4859ddf41d882";
action.srcBackupStorageUuid = "cdd6242179f037c3a2c4cd1d17678f36";
action.dstBackupStorageUuid = "eebba83336ac34938e5a6e6db30d5eb8";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverBackupFromImageStoreBackupStorageAction.Result res = action.call();RecoverBackupFromImageStoreBackupStorageAction action = RecoverBackupFromImageStoreBackupStorageAction()
action.uuid = "4c047b04165e3c8ca2b4859ddf41d882"
action.srcBackupStorageUuid = "cdd6242179f037c3a2c4cd1d17678f36"
action.dstBackupStorageUuid = "eebba83336ac34938e5a6e6db30d5eb8"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RecoverBackupFromImageStoreBackupStorageAction.Result res = action.call()SyncBackupFromImageStoreBackupStorage
API Request
PUT zstack/v1/volume-backups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"syncBackupFromImageStoreBackupStorage": {
"srcBackupStorageUuid": "8d41621b44b43562bfe415b1f4eae44c",
"dstBackupStorageUuid": "1cb923c4982d3ca397a2dca63aa0d121"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"8d41621b44b43562bfe415b1f4eae44c","dstBackupStorageUuid":"1cb923c4982d3ca397a2dca63aa0d121"}}' http://localhost:8080/zstack/v1/volume-backups/d10c8a92398a387ba00952957aeeb99c/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the volume backup. | 2.6.0 | |
| srcBackupStorageUuid | String | body (contained in the syncBackupFromImageStoreBackupStorage structure) | The local backup storage. | 2.6.0 | |
| dstBackupStorageUuid | String | body (contained in the syncBackupFromImageStoreBackupStorage structure) | The remote backup storage. | 2.6.0 | |
| systemTags | List | body | Optional. The system tags. | 2.6.0 | |
| userTags | List | body | Optional. The user tags. | 2.6.0 |
API Response
{
"inventory": {
"uuid": "b27cfbaf301433a9b81aedcc47460343",
"volumeUuid": "5058318082ae3e5abf1bd05608f8c6d2",
"name": "Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 2.6.0 |
| inventory | VolumeBackupInventory | See inventory | 2.6.0 |
| 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. | 2.6.0 |
| description | String | The brief description of the error. | 2.6.0 |
| details | String | The details about the error. | 2.6.0 |
| elaboration | String | The reserved field. Default value: null. | 2.6.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 2.6.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 2.6.0 |
| volumeUuid | String | The UUID of the volume. | 2.6.0 |
| name | String | The name of the volume backup. | 2.6.0 |
| description | String | The detailed description of the backup. | 2.6.0 |
| type | String | The type of the volume. | 2.6.0 |
| state | String | The status of the backup. | 2.6.0 |
| status | String | The availability status of the backup. | 2.6.0 |
| size | Long | The size of the backup. | 2.6.0 |
| metadata | String | The metadata of the backup. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
| backupStorageRefs | List | See backupStorageRefs | 2.6.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 2.6.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 2.6.0 |
| installPath | String | The storage path of the backup. | 2.6.0 |
| status | String | The status of the backup in the backup storage. | 2.6.0 |
| createDate | Timestamp | The time when the backup was created. | 2.6.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 2.6.0 |
SDK Sample
SyncBackupFromImageStoreBackupStorageAction action = new SyncBackupFromImageStoreBackupStorageAction();
action.uuid = "d10c8a92398a387ba00952957aeeb99c";
action.srcBackupStorageUuid = "8d41621b44b43562bfe415b1f4eae44c";
action.dstBackupStorageUuid = "1cb923c4982d3ca397a2dca63aa0d121";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncBackupFromImageStoreBackupStorageAction.Result res = action.call();SyncBackupFromImageStoreBackupStorageAction action = SyncBackupFromImageStoreBackupStorageAction()
action.uuid = "d10c8a92398a387ba00952957aeeb99c"
action.srcBackupStorageUuid = "8d41621b44b43562bfe415b1f4eae44c"
action.dstBackupStorageUuid = "1cb923c4982d3ca397a2dca63aa0d121"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncBackupFromImageStoreBackupStorageAction.Result res = action.call()CreateVmBackup
API Request
POST zstack/v1/volumes/{rootVolumeUuid}/vm-backupsAuthorization: OAuth the-session-uuid{
"params": {
"backupStorageUuid": "fc50c1ece4753c1981e3e3f65a151e0e",
"name": "backup-1",
"description": "a critical volume backup"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"fc50c1ece4753c1981e3e3f65a151e0e","name":"backup-1","description":"a critical volume backup"}}' http://localhost:8080/zstack/v1/volumes/aa6fad9b71af3785a9fdec200bab3ee8/vm-backups| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| rootVolumeUuid | String | url | The UUID of the root volume. | 3.0.0 | |
| backupStorageUuid | String | body (contained in the params structure) | The UUID of the backup storage. | 3.0.0 | |
| name | String | body (contained in the params structure) | The name of the VM backup. | 3.0.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the backup. | 3.0.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.0.0 | |
| volumeReadBandwidth | Long | body (contained in the params structure) | Optional. The maximum speed at which data is read from the root volume. | 3.1.0 | |
| volumeWriteBandwidth | Long | body (contained in the params structure) | Optional. The maximum speed at which data is written to the root volume. | 3.1.0 | |
| networkReadBandwidth | Long | body (contained in the params structure) | Optional. The network bandwidth for data reads. | 3.1.0 | |
| networkWriteBandwidth | Long | body (contained in the params structure) | Optional. The network bandwidth for data writes. | 3.1.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
Note:
- When you create a VM backup in ZStack Cloud, the
data of the VM instance in a host will be backed up to an ImageStore
backup storage. The data exchange in this process will use the backup
network. Note that you can add the backupnetwork option to
SystemTags.
- Format of the backupnetwork option:
backup::network::cidr::CIDR - Example:
backup::network::cidr::10.0.0.0/8
- Format of the backupnetwork option:
- When you create a VM backup in ZStack Cloud, you
can specify how to back up the VM instance data to the backup storage by
adding the fsInfo option to SystemTags.
- Format of the fsInfo option:
fsInfo::type::$TYPE::url::$URL::options::$OPTIONS - Example:
fsInfo::type::nfs::url::172.32.1.119:/nas/nfs2::options::nolock,vers=3,rsize=32768,wsize=32768
- Format of the fsInfo option:
- When you create a VM backup in ZStack Cloud, you
can configure the concurrency level for the VM backup by adding the
volumeLiveBackup option to SystemTags.
- Format of the volumeLiveBackup option:
volumeLiveBackup::parallelismDegree::$NUMBER - Example:
volumeLiveBackup::parallelismDegree::1
- Format of the volumeLiveBackup option:
API Response
{
"inventories": [
{
"uuid": "785edb93bb1b3a31857dac1e69cc8392",
"volumeUuid": "2ae6b881bb1239cd907d48993e86a2e8",
"name": "Root-Volume-Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"groupUuid": "2f7c0a5bb86430e8a5ac48312172d70d",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
},
{
"uuid": "3084eea905f4311b9d484bfe97142bdf",
"volumeUuid": "f6c7d5276c873eba8accddd4a09a1ee6",
"name": "Data-Volume-Backup-1",
"description": "volume backup",
"size": 2.147483648E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventories | List | See inventories | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the VM backup. | 3.0.0 |
| volumeUuid | String | The UUID of the root volume. | 3.0.0 |
| name | String | The name of the backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| type | String | The type of the root volume. | 3.0.0 |
| state | String | The status of the backup. | 3.0.0 |
| status | String | The availability status of the backup. | 3.0.0 |
| size | Long | The size of the backup. | 3.0.0 |
| metadata | String | The metadata of the backup. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the VM backup. | 3.0.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | The storage path of the backup. | 3.0.0 |
| status | String | The status of the backup in the backup storage. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
CreateVmBackupAction action = new CreateVmBackupAction();
action.rootVolumeUuid = "aa6fad9b71af3785a9fdec200bab3ee8";
action.backupStorageUuid = "fc50c1ece4753c1981e3e3f65a151e0e";
action.name = "backup-1";
action.description = "a critical volume backup";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmBackupAction.Result res = action.call();CreateVmBackupAction action = CreateVmBackupAction()
action.rootVolumeUuid = "aa6fad9b71af3785a9fdec200bab3ee8"
action.backupStorageUuid = "fc50c1ece4753c1981e3e3f65a151e0e"
action.name = "backup-1"
action.description = "a critical volume backup"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmBackupAction.Result res = action.call()DeleteVmBackup
API Request
DELETE zstack/v1/vm-backups/{groupUuid}?backupStorageUuids={backupStorageUuids}&deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vm-backups/92046c016d7c3af7bdd4a5077fb91450?backupStorageUuids=255fc896605f3237a22940fa92d8670b&deleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | The UUID of the backup group. | 3.0.0 | |
| backupStorageUuids | List | url | Optional. The UUIDs of backup storage. | 3.0.0 | |
| deleteMode | String | url | Optional. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteVmBackupAction action = new DeleteVmBackupAction();
action.groupUuid = "92046c016d7c3af7bdd4a5077fb91450";
action.backupStorageUuids = asList("255fc896605f3237a22940fa92d8670b");
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVmBackupAction.Result res = action.call();DeleteVmBackupAction action = DeleteVmBackupAction()
action.groupUuid = "92046c016d7c3af7bdd4a5077fb91450"
action.backupStorageUuids = [255fc896605f3237a22940fa92d8670b]
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVmBackupAction.Result res = action.call()SyncVmBackup
API Request
PUT zstack/v1/vm-backups/imageStore/{imageStoreUuid}/actionsAuthorization: OAuth the-session-uuid{
"syncVmBackup": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncVmBackup":{}}' http://localhost:8080/zstack/v1/vm-backups/imageStore/087b41055fbc4875aef622142cbe5ac3/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| imageStoreUuid | String | url | The UUID of the backup storage. | 3.5.0 | |
| systemTags | List | body | Optional. | 3.5.0 | |
| userTags | List | body | Optional. | 3.5.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
SyncVmBackupAction action = new SyncVmBackupAction();
action.imageStoreUuid = "7c3e52e35de449c9abc1343c83b93cd5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVmBackupAction.Result res = action.call();SyncVmBackupAction action = SyncVmBackupAction()
action.imageStoreUuid = "07270eb0ae25428586b224c33e88e485"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncVmBackupAction.Result res = action.call()CreateVmFromVmBackup
API Request
POST zstack/v1/vm-instances/from/vm-backups/{groupUuid}Authorization: OAuth the-session-uuid{
"params": {
"name": "vm1",
"instanceOfferingUuid": "7d608371542b3ab5960823c1b57bfa0c",
"l3NetworkUuids": [
"6ab4d28582d232708ed2912c1c3eb1ef"
],
"clusterUuid": "84a216b8b0323b87bf9d2b32abc635a3",
"description": "this is a vm"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"vm1","instanceOfferingUuid":"7d608371542b3ab5960823c1b57bfa0c","l3NetworkUuids":["6ab4d28582d232708ed2912c1c3eb1ef"],"clusterUuid":"84a216b8b0323b87bf9d2b32abc635a3","description":"this is a vm"}}' http://localhost:8080/zstack/v1/vm-instances/from/vm-backups/04ac2beae2b03def881dea125299498c| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the VM. | 3.0.0 | |
| groupUuid | String | url | The UUID of the VM backup group. | 3.0.0 | |
| backupStorageUuid | String | body (contained in the params structure) | Optional. The UUID of the backup storage. | 0.6 | |
| instanceOfferingUuid | String | body (contained in the params structure) | The UUID of the instance offering. | 3.0.0 | |
| l3NetworkUuids | List | body (contained in the params structure) | The UUIDs of L3 networks. | 3.0.0 | |
| type | String | body (contained in the params structure) | Optional. The type of the VM instance. |
|
3.0.0 |
| zoneUuid | String | body (contained in the params structure) | Optional. The zone UUID. | 3.0.0 | |
| clusterUuid | String | body (contained in the params structure) | Optional. The cluster UUID. | 3.0.0 | |
| hostUuid | String | body (contained in the params structure) | Optional. The host UUID. | 3.0.0 | |
| primaryStorageUuidForRootVolume | String | body (contained in the params structure) | Optional. The primary storage used to host the root volume. | 3.0.0 | |
| primaryStorageUuidForDataVolume | String | body (contained in the params structure) | Optional. The primary storage used to host data volumes. | 3.0.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the VM. | 3.0.0 | |
| rootVolumeSystemTags | List | body (contained in the params structure) | Optional. The system tags of the root volume. | 3.0.0 | |
| dataVolumeSystemTags | List | body (contained in the params structure) | Optional. The system tags of the data volume. | 3.0.0 | |
| defaultL3NetworkUuid | String | body (contained in the params structure) | The UUID of the L3 network. | 3.0.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.0.0 | |
| systemTags | List | body | Optional. The system tags. | 3.0.0 | |
| userTags | List | body | Optional. The user tags. | 3.0.0 |
Note:
- When you create a VM instance from a VM backup, you can specify the volume provisioning strategy by adding the volumeProvisioningStrategy option to SystemTags. The SystemTag is passed by using the rootVolumeSystemTags parameter.
-
- Format of the volumeProvisioningStrategy option:
volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning - Example:
volumeProvisioningStrategy::ThinProvisioning, volumeProvisioningStrategy::ThickProvisioning
- Format of the volumeProvisioningStrategy option:
API Response
{
"inventory": {
"uuid": "a1c07d683f693f6e9f2d7f9a499c7840",
"name": "Test-VM",
"description": "web server VM",
"zoneUuid": "1e48b41ec4b63660b38a72d271c0164b",
"clusterUuid": "f29498f04b1e3c319bdaeb6b3f8259f3",
"imageUuid": "5c07704333c532e8b402b6b3ddb89315",
"hostUuid": "e18cf66eedb3306686a1d4685bbb63af",
"lastHostUuid": "4834161c409a34b6a84e40d71d85f714",
"instanceOfferingUuid": "f53ad9f147203b499dfbd93ce41b7a8e",
"rootVolumeUuid": "24b9fcb69f123ad6b3ddfffed96d2882",
"platform": "Linux",
"defaultL3NetworkUuid": "d50554f493153be78f6740e18e598046",
"type": "UserVm",
"hypervisorType": "KVM",
"memorySize": 8.589934592E9,
"cpuNum": 1.0,
"allocatorStrategy": "LastHostPreferredAllocatorStrategy",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Running",
"vmNics": [
{
"uuid": "af856a9c63e53eb5b80999e258221940",
"vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
"usedIpUuid": "9856d36e40783d669b9e4f1de41d1a17",
"l3NetworkUuid": "d50554f493153be78f6740e18e598046",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"allVolumes": [
{
"uuid": "24b9fcb69f123ad6b3ddfffed96d2882",
"name": "Root-Volume-For-VM-a1c07d683f693f6e9f2d7f9a499c7840",
"primaryStorageUuid": "be02105c2a223492a91fb09ba664ecb1",
"vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
"rootImageUuid": "5c07704333c532e8b402b6b3ddb89315",
"installPath": "/Cloud_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-24b9fcb69f123ad6b3ddfffed96d2882/24b9fcb69f123ad6b3ddfffed96d2882.qcow2",
"type": "Root",
"format": "qcow2",
"size": 1.073741824E11,
"actualSize": 2.147483648E10,
"deviceId": 0.0,
"state": "Enabled",
"status": "Ready",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventory | VmInstanceInventory | See inventory | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the VM instance. | 3.0.0 |
| name | String | The name of the VM instance. | 3.0.0 |
| description | String | The detailed description of the VM instance. | 3.0.0 |
| zoneUuid | String | The zone UUID. | 3.0.0 |
| clusterUuid | String | The cluster UUID. | 3.0.0 |
| imageUuid | String | The image UUID. | 3.0.0 |
| hostUuid | String | The host UUID. | 3.0.0 |
| lastHostUuid | String | 3.0.0 | |
| instanceOfferingUuid | String | The UUID of the instance offering. | 3.0.0 |
| rootVolumeUuid | String | The UUID of the root volume. | 3.0.0 |
| platform | String | 3.0.0 | |
| defaultL3NetworkUuid | String | 3.0.0 | |
| type | String | 3.0.0 | |
| hypervisorType | String | 3.0.0 | |
| memorySize | Long | 3.0.0 | |
| cpuNum | Integer | 3.0.0 | |
| cpuSpeed | Long | 3.0.0 | |
| allocatorStrategy | String | 3.0.0 | |
| createDate | Timestamp | The time when the VM instance was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the VM instance was last modified. | 3.0.0 |
| state | String | 3.0.0 | |
| vmNics | List | See vmNics | 3.0.0 |
| allVolumes | List | See allVolumes | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the NIC of the VM instance. | 3.0.0 |
| vmInstanceUuid | String | The UUID of the VM instance. | 3.0.0 |
| l3NetworkUuid | String | The UUID of the L3 network. | 3.0.0 |
| ip | String | 3.0.0 | |
| mac | String | 3.0.0 | |
| netmask | String | 3.0.0 | |
| gateway | String | 3.0.0 | |
| metaData | String | 3.0.0 | |
| deviceId | Integer | 3.0.0 | |
| createDate | Timestamp | The time when the NIC was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the NIC was last modified. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume. | 3.0.0 |
| name | String | The name of the volume. | 3.0.0 |
| description | String | The detailed description of the volume. | 3.0.0 |
| primaryStorageUuid | String | The UUID of the primary storage. | 3.0.0 |
| vmInstanceUuid | String | The UUID of the VM instance. | 3.0.0 |
| diskOfferingUuid | String | The UUID of the disk offering. | 3.0.0 |
| rootImageUuid | String | 3.0.0 | |
| installPath | String | 3.0.0 | |
| type | String | 3.0.0 | |
| format | String | 3.0.0 | |
| size | Long | 3.0.0 | |
| actualSize | Long | 3.0.0 | |
| deviceId | Integer | 3.0.0 | |
| state | String | 3.0.0 | |
| status | String | 3.0.0 | |
| createDate | Timestamp | The time when the volume was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the volume was last modified. | 3.0.0 |
| isShareable | Boolean | 3.0.0 |
SDK Sample
CreateVmFromVmBackupAction action = new CreateVmFromVmBackupAction();
action.name = "vm1";
action.groupUuid = "04ac2beae2b03def881dea125299498c";
action.instanceOfferingUuid = "7d608371542b3ab5960823c1b57bfa0c";
action.l3NetworkUuids = asList("6ab4d28582d232708ed2912c1c3eb1ef");
action.clusterUuid = "84a216b8b0323b87bf9d2b32abc635a3";
action.description = "this is a vm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromVmBackupAction.Result res = action.call();CreateVmFromVmBackupAction action = CreateVmFromVmBackupAction()
action.name = "vm1"
action.groupUuid = "04ac2beae2b03def881dea125299498c"
action.instanceOfferingUuid = "7d608371542b3ab5960823c1b57bfa0c"
action.l3NetworkUuids = [6ab4d28582d232708ed2912c1c3eb1ef]
action.clusterUuid = "84a216b8b0323b87bf9d2b32abc635a3"
action.description = "this is a vm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmFromVmBackupAction.Result res = action.call()RevertVmFromVmBackup
API Request
PUT zstack/v1/vm-backups/{groupUuid}/actionsAuthorization: OAuth the-session-uuid{
"revertVmFromVmBackup": {
"backupStorageUuid": "99afb6149155396c8ac1b6ab62badb9d"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revertVmFromVmBackup":{"backupStorageUuid":"99afb6149155396c8ac1b6ab62badb9d"}}' http://localhost:8080/zstack/v1/vm-backups/39f4e3c4b7553dbc98b8c0ce0e8f82a1/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | The UUID of the backup group. | 3.0.0 | |
| backupStorageUuid | String | body (contained in the revertVmFromVmBackup structure) | Optional. The UUID of the backup storage. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
RevertVmFromVmBackupAction action = new RevertVmFromVmBackupAction();
action.groupUuid = "39f4e3c4b7553dbc98b8c0ce0e8f82a1";
action.backupStorageUuid = "99afb6149155396c8ac1b6ab62badb9d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevertVmFromVmBackupAction.Result res = action.call();RevertVmFromVmBackupAction action = RevertVmFromVmBackupAction()
action.groupUuid = "39f4e3c4b7553dbc98b8c0ce0e8f82a1"
action.backupStorageUuid = "99afb6149155396c8ac1b6ab62badb9d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevertVmFromVmBackupAction.Result res = action.call()RecoverVmBackupFromImageStoreBackupStorage)
API Request
PUT zstack/v1/vm-backups/{groupUuid}/actionsAuthorization: OAuth the-session-uuid{
"recoverVmBackupFromImageStoreBackupStorage": {
"srcBackupStorageUuid": "c63b10a638f6302caeabb7a806d087ad",
"dstBackupStorageUuid": "7c7d653af1c531dfa04dabea3a085de5"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverVmBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"c63b10a638f6302caeabb7a806d087ad","dstBackupStorageUuid":"7c7d653af1c531dfa04dabea3a085de5"}}' http://localhost:8080/zstack/v1/vm-backups/7913ce9f37973f4e8339aea4ff61584c/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | The UUID of the VM backup group. | 3.0.0 | |
| srcBackupStorageUuid | String | body(contained in the recoverVmBackupFromImageStoreBackupStorage structure) | The local backup storage. | 3.0.0 | |
| dstBackupStorageUuid | String | body(contained in the recoverVmBackupFromImageStoreBackupStorage structure) | The remote backup storage. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"inventories": [
{
"uuid": "5e28a0c27a8e352bbeedff94a0326f9e",
"volumeUuid": "aa5fbdba3ffa352bbefaf913f56949f3",
"name": "Root-Volume-Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"groupUuid": "0150a8120f9334db8e9abc9d3f5eea08",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
},
{
"uuid": "5924c90ddbcb3784ae6e78b70ede90ce",
"volumeUuid": "12d583f519f03a0593dff7514af65be4",
"name": "Data-Volume-Backup-1",
"description": "volume backup",
"size": 2.147483648E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventories | List | See inventories | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 3.0.0 |
| volumeUuid | String | The UUID of the volume. | 3.0.0 |
| name | String | The name of the volume backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| type | String | The type of the volume. | 3.0.0 |
| state | String | The status of the backup. | 3.0.0 |
| status | String | The availability status of the backup. | 3.0.0 |
| size | Long | The size of the backup. | 3.0.0 |
| metadata | String | The metadata of the backup. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 3.0.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | The storage path of the backup. | 3.0.0 |
| status | String | The status of the backup in the backup storage. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
RecoverVmBackupFromImageStoreBackupStorageAction action = new RecoverVmBackupFromImageStoreBackupStorageAction();
action.groupUuid = "7913ce9f37973f4e8339aea4ff61584c";
action.srcBackupStorageUuid = "c63b10a638f6302caeabb7a806d087ad";
action.dstBackupStorageUuid = "7c7d653af1c531dfa04dabea3a085de5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverVmBackupFromImageStoreBackupStorageAction.Result res = action.call();RecoverVmBackupFromImageStoreBackupStorageAction action = RecoverVmBackupFromImageStoreBackupStorageAction()
action.groupUuid = "7913ce9f37973f4e8339aea4ff61584c"
action.srcBackupStorageUuid = "c63b10a638f6302caeabb7a806d087ad"
action.dstBackupStorageUuid = "7c7d653af1c531dfa04dabea3a085de5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RecoverVmBackupFromImageStoreBackupStorageAction.Result res = action.call()SyncVmBackupFromImageStoreBackupStorage
API Request
PUT zstack/v1/vm-backups/{groupUuid}/actionsAuthorization: OAuth the-session-uuid{
"syncVmBackupFromImageStoreBackupStorage": {
"srcBackupStorageUuid": "3428f7d03e493f89b32c57ef80a7e5af",
"dstBackupStorageUuid": "6f8c528537a9347a86da7a96fb7418d4"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncVmBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"3428f7d03e493f89b32c57ef80a7e5af","dstBackupStorageUuid":"6f8c528537a9347a86da7a96fb7418d4"}}' http://localhost:8080/zstack/v1/vm-backups/14e53ad2aecd3e7ebe1f05cb4f5dd6a5/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| groupUuid | String | url | The UUID of the backup group. | 3.0.0 | |
| srcBackupStorageUuid | String | body(contained in the syncVmBackupFromImageStoreBackupStorage structure) | The local backup storage. | 3.0.0 | |
| dstBackupStorageUuid | String | body(contained in the syncVmBackupFromImageStoreBackupStorage structure) | The remote backup storage. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"inventories": [
{
"uuid": "cf59b77253e134e483ceda7e21c6bf15",
"volumeUuid": "6be74434a84e3c939830a3987488a499",
"name": "Root-Volume-Backup-1",
"description": "volume backup",
"size": 1.073741824E9,
"groupUuid": "09d5949ca5f233c2adcf4c278f537cef",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
},
{
"uuid": "c546170919a4300e9b3d3e29fc27de7f",
"volumeUuid": "39656103b9e7391e89071517f9d21b91",
"name": "Data-Volume-Backup-1",
"description": "volume backup",
"size": 2.147483648E9,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventories | List | See inventories | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the volume backup. | 3.0.0 |
| volumeUuid | String | The UUID of the volume. | 3.0.0 |
| name | String | The name of the volume backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| type | String | The type of the volume. | 3.0.0 |
| state | String | The status of the backup. | 3.0.0 |
| status | String | The availability status of the backup. | 3.0.0 |
| size | Long | The size of the backup. | 3.0.0 |
| metadata | String | The metadata of the backup. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| volumeBackupUuid | String | The UUID of the volume backup. | 3.0.0 |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | The storage path of the backup. | 3.0.0 |
| status | String | The status of the backup in the backup storage. | 3.0.0 |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
SyncVmBackupFromImageStoreBackupStorageAction action = new SyncVmBackupFromImageStoreBackupStorageAction();
action.groupUuid = "14e53ad2aecd3e7ebe1f05cb4f5dd6a5";
action.srcBackupStorageUuid = "3428f7d03e493f89b32c57ef80a7e5af";
action.dstBackupStorageUuid = "6f8c528537a9347a86da7a96fb7418d4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVmBackupFromImageStoreBackupStorageAction.Result res = action.call();SyncVmBackupFromImageStoreBackupStorageAction action = SyncVmBackupFromImageStoreBackupStorageAction()
action.groupUuid = "14e53ad2aecd3e7ebe1f05cb4f5dd6a5"
action.srcBackupStorageUuid = "3428f7d03e493f89b32c57ef80a7e5af"
action.dstBackupStorageUuid = "6f8c528537a9347a86da7a96fb7418d4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncVmBackupFromImageStoreBackupStorageAction.Result res = action.call()CreateDatabaseBackup
API Request
POST zstack/v1/database-backupsAuthorization: OAuth the-session-uuid{
"params": {
"name": "zstack-db",
"backupStorageUuid": "676c5945223647698fcf4da2fa46d1dd"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"zstack-db","backupStorageUuid":"0c0f5fc523d8420a97a9be367f112b4a"}}' http://localhost:8080/zstack/v1/database-backups| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the database backup. | 3.0.0 | |
| description | String | body (contained in the params structure) | The detailed description of the backup. | 3.0.0 | |
| backupStorageUuid | String | body (contained in the params structure) | The UUID of the backup storage. | 3.0.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"inventory": {
"uuid": "7decf4a7cb7c41dabc57446df2784476",
"name": "zsdb",
"state": "Enabled",
"size": 1000.0,
"metadata": "{\"version\":\"3.0.0\"}",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventory | DatabaseBackupInventory | See inventory | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the database backup. | 3.0.0 |
| name | String | The name of the backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| state | String | 3.0.0 | |
| status | String | 3.0.0 | |
| size | Long | 3.0.0 | |
| metadata | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| databaseBackupUuid | String | 3.0.0 | |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | 3.0.0 | |
| exportUrl | String | 3.0.0 | |
| status | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
CreateDatabaseBackupAction action = new CreateDatabaseBackupAction();
action.name = "zstack-db";
action.backupStorageUuid = "35c0d1e417d84bf498be201091f39c49";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDatabaseBackupAction.Result res = action.call();CreateDatabaseBackupAction action = CreateDatabaseBackupAction()
action.name = "zstack-db"
action.backupStorageUuid = "476870bf9c4241c8993340bd0703d0bf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDatabaseBackupAction.Result res = action.call()DeleteDatabaseBackup
API Request
DELETE zstack/v1/database-backups/{uuid}?backupStorageUuids={backupStorageUuids}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/database-backups/9caf0430ce473651ae7033e1a16a0097?backupStorageUuids=0c54ad64cd8d3ca1ba9d98864bb83571| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the database backup. | 3.0.0 | |
| backupStorageUuids | List | url | Optional. The UUIDs of backup storage. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteDatabaseBackupAction action = new DeleteDatabaseBackupAction();
action.uuid = "9caf0430ce473651ae7033e1a16a0097";
action.backupStorageUuids = asList("0c54ad64cd8d3ca1ba9d98864bb83571");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteDatabaseBackupAction.Result res = action.call();DeleteDatabaseBackupAction action = DeleteDatabaseBackupAction()
action.uuid = "9caf0430ce473651ae7033e1a16a0097"
action.backupStorageUuids = [0c54ad64cd8d3ca1ba9d98864bb83571]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteDatabaseBackupAction.Result res = action.call()QueryDatabaseBackup
API Request
GET zstack/v1/database-backups
GET zstack/v1/database-backups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups?q=uuid=9f5010336a233d6ebbd82594a6d56e7ccurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups/296a7da913333dd992d89bf30d9304edQueryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryDatabaseBackup, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "742a7c7d4a4f3a01b206632a40ac414f",
"name": "db-backup",
"description": "db-backup",
"size": 13107.0
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.0.0 |
| inventories | List | See inventories | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the database backup. | 3.0.0 |
| name | String | The name of the backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| state | String | 3.0.0 | |
| status | String | 3.0.0 | |
| size | Long | 3.0.0 | |
| metadata | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| databaseBackupUuid | String | 3.0.0 | |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | 3.0.0 | |
| exportUrl | String | 3.0.0 | |
| status | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
QueryDatabaseBackupAction action = new QueryDatabaseBackupAction();
action.conditions = asList("uuid=74b420b3e877354e832a900915aab41a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryDatabaseBackupAction.Result res = action.call();QueryDatabaseBackupAction action = QueryDatabaseBackupAction()
action.conditions = ["uuid=b11af605703231b4a898bed3fb7d94c0"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryDatabaseBackupAction.Result res = action.call()SyncDatabaseBackup
API Request
PUT zstack/v1/database-backups/imageStore/{imageStoreUuid}/actionsAuthorization: OAuth the-session-uuid{
"syncDatabaseBackup": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncDatabaseBackup":{}}' http://localhost:8080/zstack/v1/database-backups/imageStore/2df92dfaba994da18c6a9801268d1703/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| imageStoreUuid | String | url | 3.2.0 | ||
| systemTags | List | body | Optional. | 3.2.0 | |
| userTags | List | body | Optional. | 3.2.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
SyncDatabaseBackupAction action = new SyncDatabaseBackupAction();
action.imageStoreUuid = "e0803f92a12b42688d20f68beef19588";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncDatabaseBackupAction.Result res = action.call();SyncDatabaseBackupAction action = SyncDatabaseBackupAction()
action.imageStoreUuid = "0de54b0b3067493f9461fc74906dfc54"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncDatabaseBackupAction.Result res = action.call()RecoverDatabaseFromBackup
API Request
PUT zstack/v1/database-backups/actions?uuid={uuid}Authorization: OAuth the-session-uuid{
"recoverDatabaseFromBackup": {
"backupStorageUrl": "ssh://root:password@localhost:22/Cloud_bs",
"backupInstallPath": "zstore://zsbak/0ed599ec519249489475112a058bb93a",
"mysqlRootPassword": "password"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverDatabaseFromBackup":{"backupStorageUrl":"ssh://root:password@localhost:22/Cloud_bs","backupInstallPath":"zstore://zsbak/0ed599ec519249489475112a058bb93a","mysqlRootPassword":"password"}}' http://localhost:8080/zstack/v1/database-backups/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Optional. The UUID of the database backup. | 3.0.0 | |
| backupStorageUrl | String | body(contained in the recoverDatabaseFromBackup structure) | Optional. The URL of the backup storage. | 3.0.0 | |
| backupInstallPath | String | body(contained in the recoverDatabaseFromBackup structure) | Optional. The storage path of the database backup. | 3.0.0 | |
| mysqlRootPassword | String | body(contained in the recoverDatabaseFromBackup structure) | The root password of the MySQL database. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"logListenPort": 0.0
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| logListenPort | int | The port that the browser listens to print logs in real time. | 3.0.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
SDK Sample
RecoverDatabaseFromBackupAction action = new RecoverDatabaseFromBackupAction();
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs";
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a";
action.mysqlRootPassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverDatabaseFromBackupAction.Result res = action.call();RecoverDatabaseFromBackupAction action = RecoverDatabaseFromBackupAction()
action.backupStorageUrl = "ssh://root:password@localhost:22/Cloud_bs"
action.backupInstallPath = "zstore://zsbak/0ed599ec519249489475112a058bb93a"
action.mysqlRootPassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RecoverDatabaseFromBackupAction.Result res = action.call()ExportDatabaseBackupFromBackupStorage
API Request
PUT zstack/v1/database-backups/{databaseBackupUuid}/backup-storage/{backupStorageUuid}/actionsAuthorization: OAuth the-session-uuid{
"exportDatabaseBackupFromBackupStorage": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"exportDatabaseBackupFromBackupStorage":{}}' http://localhost:8080/zstack/v1/database-backups/6dae84793fc53f5b82034dd9a44c554b/backup-storage/cc9127f6af0e32c888044f49048788a1/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| backupStorageUuid | String | url | The UUID of the backup storage. | 3.0.0 | |
| databaseBackupUuid | String | url | The UUID of the database backup. | 3.0.0 | |
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"databaseBackupUrl": "http://127.0.0.1:8001/path/zstack-db-backup.gz"
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| databaseBackupUrl | String | The URL of the exported database backup. | 3.0.0 |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
SDK Sample
ExportDatabaseBackupFromBackupStorageAction action = new ExportDatabaseBackupFromBackupStorageAction();
action.backupStorageUuid = "cc9127f6af0e32c888044f49048788a1";
action.databaseBackupUuid = "6dae84793fc53f5b82034dd9a44c554b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExportDatabaseBackupFromBackupStorageAction.Result res = action.call();ExportDatabaseBackupFromBackupStorageAction action = ExportDatabaseBackupFromBackupStorageAction()
action.backupStorageUuid = "cc9127f6af0e32c888044f49048788a1"
action.databaseBackupUuid = "6dae84793fc53f5b82034dd9a44c554b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ExportDatabaseBackupFromBackupStorageAction.Result res = action.call()GetDatabaseBackupFromImageStore
API Request
GET zstack/v1/database-backups/image-storeAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups/image-store?url=ssh://root:password@localhost:22/Cloud_bs®istryPort=8000.0| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| url | String | query | The URL of the backup storage. | 3.0.0 | |
| registryPort | int | query | Optional. The port used to access the backup storage. | 3.0.0 | |
| systemTags | List | query | Optional. | 3.0.0 | |
| userTags | List | query | Optional. | 3.0.0 |
API Response
{
"infos": [
{
"id": "270c67e3699f72ba",
"created": "Nov 14, 2017 10:20:57 PM",
"author": "zstack",
"arch": "amd64",
"size": 7995392.0,
"virtualsize": 1.268224E7,
"name": "78b6afbc9da73932a000fb9a75947962"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.0.0 |
| infos | List | See infos | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | String | The ID of the database backup image in the backup storage. | 3.0.0 |
| parent | String | The name of the parent image. | 3.0.0 |
| blobsum | String | The hash of the image. | 3.0.0 |
| created | Timestamp | The time when the image was created. | 3.0.0 |
| author | String | The author of the image. | 3.0.0 |
| arch | String | The OS structure of the image. | 3.0.0 |
| desc | String | The description of the image. | 3.0.0 |
| size | Long | The actual size of the image. | 3.0.0 |
| virtualsize | Long | The virtualized size of the image. | 3.0.0 |
| name | String | The name of the image in the backup storage. | 3.0.0 |
SDK Sample
GetDatabaseBackupFromImageStoreAction action = new GetDatabaseBackupFromImageStoreAction();
action.url = "ssh://root:password@localhost:22/Cloud_bs";
action.registryPort = 8000.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetDatabaseBackupFromImageStoreAction.Result res = action.call();GetDatabaseBackupFromImageStoreAction action = GetDatabaseBackupFromImageStoreAction()
action.url = "ssh://root:password@localhost:22/Cloud_bs"
action.registryPort = 8000.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetDatabaseBackupFromImageStoreAction.Result res = action.call()DeleteExportedDatabaseBackupFromBackupStorage
API Request
DELETE zstack/v1/exported-database-backup/{databaseBackupUuid}/backup-storage/{backupStorageUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/exported-database-backup/341a599af82f3ecbab5d680e8dfb0276/backup-storage/737f27cb664c31a594f71080d481dddf?| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| backupStorageUuid | String | url | The UUID of the backup storage. | 3.0.0 | |
| databaseBackupUuid | String | url | 3.0.0 | ||
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteExportedDatabaseBackupFromBackupStorageAction action = new DeleteExportedDatabaseBackupFromBackupStorageAction();
action.backupStorageUuid = "737f27cb664c31a594f71080d481dddf";
action.databaseBackupUuid = "341a599af82f3ecbab5d680e8dfb0276";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteExportedDatabaseBackupFromBackupStorageAction.Result res = action.call();DeleteExportedDatabaseBackupFromBackupStorageAction action = DeleteExportedDatabaseBackupFromBackupStorageAction()
action.backupStorageUuid = "737f27cb664c31a594f71080d481dddf"
action.databaseBackupUuid = "341a599af82f3ecbab5d680e8dfb0276"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteExportedDatabaseBackupFromBackupStorageAction.Result res = action.call()SyncDatabaseBackupFromImageStoreBackupStorage
API Request
PUT zstack/v1/database-backups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"syncDatabaseBackupFromImageStoreBackupStorage": {
"srcBackupStorageUuid": "72ad4c5419d63f5aaf37faf985c95a65",
"dstBackupStorageUuid": "76b2c6b412a73ef8a4263e659c104fff"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncDatabaseBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"72ad4c5419d63f5aaf37faf985c95a65","dstBackupStorageUuid":"76b2c6b412a73ef8a4263e659c104fff"}}' http://localhost:8080/zstack/v1/database-backups/4594a949f00e3a55932f5b5e66ec9d67/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the database backup. | 3.0.0 | |
| srcBackupStorageUuid | String | body(contained in the syncDatabaseBackupFromImageStoreBackupStorage structure) | 3.0.0 | ||
| dstBackupStorageUuid | String | body(contained in the syncDatabaseBackupFromImageStoreBackupStorage structure) | 3.0.0 | ||
| systemTags | List | body | Optional. | 3.0.0 | |
| userTags | List | body | Optional. | 3.0.0 |
API Response
{
"inventory": {
"uuid": "c04683f1c53039d1bb0b0f0b601b5a5b",
"name": "Backup-1",
"description": "database backup",
"size": 1048576.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.0.0 |
| inventory | DatabaseBackupInventory | See inventory | 3.0.0 |
| 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. | 3.0.0 |
| description | String | The brief description of the error. | 3.0.0 |
| details | String | The details about the error. | 3.0.0 |
| elaboration | String | The reserved field. Default value: null. | 3.0.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.0.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the database backup. | 3.0.0 |
| name | String | The name of the backup. | 3.0.0 |
| description | String | The detailed description of the backup. | 3.0.0 |
| state | String | 3.0.0 | |
| status | String | 3.0.0 | |
| size | Long | 3.0.0 | |
| metadata | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
| backupStorageRefs | List | See backupStorageRefs | 3.0.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| databaseBackupUuid | String | 3.0.0 | |
| backupStorageUuid | String | The UUID of the backup storage. | 3.0.0 |
| installPath | String | 3.0.0 | |
| exportUrl | String | 3.0.0 | |
| status | String | 3.0.0 | |
| createDate | Timestamp | The time when the backup was created. | 3.0.0 |
| lastOpDate | Timestamp | The time when the backup was last modified. | 3.0.0 |
SDK Sample
SyncDatabaseBackupFromImageStoreBackupStorageAction action = new SyncDatabaseBackupFromImageStoreBackupStorageAction();
action.uuid = "4594a949f00e3a55932f5b5e66ec9d67";
action.srcBackupStorageUuid = "72ad4c5419d63f5aaf37faf985c95a65";
action.dstBackupStorageUuid = "76b2c6b412a73ef8a4263e659c104fff";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncDatabaseBackupFromImageStoreBackupStorageAction.Result res = action.call();SyncDatabaseBackupFromImageStoreBackupStorageAction action = SyncDatabaseBackupFromImageStoreBackupStorageAction()
action.uuid = "4594a949f00e3a55932f5b5e66ec9d67"
action.srcBackupStorageUuid = "72ad4c5419d63f5aaf37faf985c95a65"
action.dstBackupStorageUuid = "76b2c6b412a73ef8a4263e659c104fff"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncDatabaseBackupFromImageStoreBackupStorageAction.Result res = action.call()AddSchedulerJobGroupToSchedulerTrigger
API Request
POST zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/scheduler/triggers/{schedulerTriggerUuid}Authorization: OAuth the-session-uuid{
"params": {
"triggerNow": false
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"triggerNow":false}}' http://localhost:8080/zstack/v1/scheduler/jobgroups/997c126bb3db39f6bbda1ffe90008f51/scheduler/triggers/78341d4e8f683a3291527f4944fa6831| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| schedulerJobGroupUuid | String | url | The UUID of the scheduled job group. | 3.4.0 | |
| schedulerTriggerUuid | String | url | The UUID of the trigger. | 3.4.0 | |
| triggerNow | boolean | body (contained in the params structure) | Optional. Specify whether to trigger a job group now. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"inventory": {
"schedulerJobGroupUuid": "ec8d2952f8f13747bbbf24f93585a63d",
"schedulerTriggerUuid": "4b5bc56b58623324afe0a57951a96064"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.4.0 |
| inventory | SchedulerJobGroupSchedulerTriggerRefInventory | See inventory | 3.4.0 |
| 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. | 3.4.0 |
| description | String | The brief description of the error. | 3.4.0 |
| details | String | The details about the error. | 3.4.0 |
| elaboration | String | The reserved field. Default value: null. | 3.4.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.4.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| schedulerJobGroupUuid | String | The UUID of the scheduled job group. | 3.4.0 |
| schedulerTriggerUuid | String | The UUID of the trigger. | 3.4.0 |
| createDate | Timestamp | The time when the trigger was created. | 3.4.0 |
| lastOpDate | Timestamp | The time when the trigger was last modified. | 3.4.0 |
SDK Sample
AddSchedulerJobGroupToSchedulerTriggerAction action = new AddSchedulerJobGroupToSchedulerTriggerAction();
action.schedulerJobGroupUuid = "997c126bb3db39f6bbda1ffe90008f51";
action.schedulerTriggerUuid = "78341d4e8f683a3291527f4944fa6831";
action.triggerNow = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobGroupToSchedulerTriggerAction.Result res = action.call();AddSchedulerJobGroupToSchedulerTriggerAction action = AddSchedulerJobGroupToSchedulerTriggerAction()
action.schedulerJobGroupUuid = "997c126bb3db39f6bbda1ffe90008f51"
action.schedulerTriggerUuid = "78341d4e8f683a3291527f4944fa6831"
action.triggerNow = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSchedulerJobGroupToSchedulerTriggerAction.Result res = action.call()RemoveSchedulerJobGroupFromSchedulerTrigger
API Request
DELETE zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/scheduler/triggers/{schedulerTriggerUuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/769b8cc2ba343736a919f4a849663fdb/scheduler/triggers/e0f1e497653b39639ff6eac7f6cd2e48?| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| schedulerJobGroupUuid | String | url | The UUID of the scheduled job group. | 3.4.0 | |
| schedulerTriggerUuid | String | url | The UUID of the trigger. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
RemoveSchedulerJobGroupFromSchedulerTriggerAction action = new RemoveSchedulerJobGroupFromSchedulerTriggerAction();
action.schedulerJobGroupUuid = "769b8cc2ba343736a919f4a849663fdb";
action.schedulerTriggerUuid = "e0f1e497653b39639ff6eac7f6cd2e48";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSchedulerJobGroupFromSchedulerTriggerAction.Result res = action.call();RemoveSchedulerJobGroupFromSchedulerTriggerAction action = RemoveSchedulerJobGroupFromSchedulerTriggerAction()
action.schedulerJobGroupUuid = "769b8cc2ba343736a919f4a849663fdb"
action.schedulerTriggerUuid = "e0f1e497653b39639ff6eac7f6cd2e48"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSchedulerJobGroupFromSchedulerTriggerAction.Result res = action.call()RunSchedulerTrigger
API Request
PUT zstack/v1/scheduler/triggers/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"runSchedulerTrigger": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"runSchedulerTrigger":{}}' http://localhost:8080/zstack/v1/scheduler/triggers/2a486c1cd0cd43f3ac40bd60c6dd6fc1/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the scheduler trigger. | 3.5.0 | |
| jobUuids | List | body(contained in the runSchedulerTrigger structure) | Optional. The UUIDs of jobs. | 3.5.0 | |
| systemTags | List | body | Optional. | 3.5.0 | |
| userTags | List | body | Optional. | 3.5.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
RunSchedulerTriggerAction action = new RunSchedulerTriggerAction();
action.uuid = "61b439ee76004c51bc262324d6eaa332";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RunSchedulerTriggerAction.Result res = action.call();RunSchedulerTriggerAction action = RunSchedulerTriggerAction()
action.uuid = "8a5ed7d3e0194c2a98d1ecb529b15875"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RunSchedulerTriggerAction.Result res = action.call()CreateSchedulerJobGroup
API Request
POST zstack/v1/scheduler/jobgroupsAuthorization: OAuth the-session-uuid{
"params": {
"name": "job",
"description": "description",
"type": "startVm"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"job","description":"description","type":"startVm"}}' http://localhost:8080/zstack/v1/scheduler/jobgroups| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name of the job group to be scheduled. | 3.4.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the job group to be scheduled. | 3.4.0 | |
| type | String | body (contained in the params structure) | The type of the jobs. |
|
4.3.0 |
| parameters | Map | body (contained in the params structure) | Optional The parameters of the jobs. | 3.4.0 | |
| resourceUuid | String | body (contained in the params structure) | Optional. Specify a UUID for the job group. | 3.4.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The UUIDs of the tags. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"inventory": {
"uuid": "0cd85a37bb88346c8c2d122913d812df",
"targetResourceUuid": "c458e0fb141932d0a87af999b0d0ab81",
"name": "SchedulerJob",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.4.0 |
| inventory | SchedulerJobInventory | See inventory | 3.4.0 |
| 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. | 3.4.0 |
| description | String | The brief description of the error. | 3.4.0 |
| details | String | The details about the error. | 3.4.0 |
| elaboration | String | The reserved field. Default value: null. | 3.4.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.4.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the job group. | 3.4.0 |
| targetResourceUuid | String | 3.4.0 | |
| name | String | The name of the job group. | 3.4.0 |
| description | String | The detailed description of the job group. | 3.4.0 |
| state | String | 3.4.0 | |
| createDate | Timestamp | The time when the job group was created. | 3.4.0 |
| lastOpDate | Timestamp | The time when the job group was last modified. | 3.4.0 |
| triggersUuid | List | 3.4.0 |
SDK Sample
CreateSchedulerJobGroupAction action = new CreateSchedulerJobGroupAction();
action.name = "job";
action.description = "description";
action.type = "startVm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSchedulerJobGroupAction.Result res = action.call();CreateSchedulerJobGroupAction action = CreateSchedulerJobGroupAction()
action.name = "job"
action.description = "description"
action.type = "startVm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSchedulerJobGroupAction.Result res = action.call()DeleteSchedulerJobGroup
API Request
DELETE zstack/v1/scheduler/jobgroups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/8bf8b175d6ce337eb24cbe37d9fe9b82| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the job group. | 3.4.0 | |
| deleteMode | String | body | Optional. The mode under which the job group is deleted. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
DeleteSchedulerJobGroupAction action = new DeleteSchedulerJobGroupAction();
action.uuid = "8bf8b175d6ce337eb24cbe37d9fe9b82";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSchedulerJobGroupAction.Result res = action.call();DeleteSchedulerJobGroupAction action = DeleteSchedulerJobGroupAction()
action.uuid = "8bf8b175d6ce337eb24cbe37d9fe9b82"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSchedulerJobGroupAction.Result res = action.call()UpdateSchedulerJobGroup
API Request
PUT zstack/v1/scheduler/jobgroups/{uuid}/actionsAuthorization: OAuth the-session-uuid{
"updateSchedulerJobGroup": {
"name": "Test2",
"description": "new test"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSchedulerJobGroup":{"name":"Test2","description":"new test"}}' http://localhost:8080/zstack/v1/scheduler/jobgroups/4dc1dbf847d733fc98ee2998b5e0eca2/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the job group. | 3.4.0 | |
| name | String | body(contained in the updateSchedulerJobGroup structure) | Optional. The name of the job group. | 3.4.0 | |
| description | String | body(contained in the updateSchedulerJobGroup structure) | Optional. The detailed description of the job group | 3.4.0 | |
| state | String | body(contained in the updateSchedulerJobGroup structure) | Optional. The state of the job group. |
|
3.4.0 |
| parameters | Map | body(contained in the updateSchedulerJobGroup structure) | Optional The parameters of the job group. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"inventory": {
"uuid": "e344fd75079735369cbffda253cc173c",
"name": "Test",
"description": "create volume snapshot job",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.4.0 |
| inventory | SchedulerJobGroupInventory | See inventory | 3.4.0 |
| 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. | 3.4.0 |
| description | String | The brief description of the error. | 3.4.0 |
| details | String | The details about the error. | 3.4.0 |
| elaboration | String | The reserved field. Default value: null. | 3.4.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.4.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the job group. | 3.4.0 |
| name | String | The name of the job group. | 3.4.0 |
| description | String | The detailed description of the job group. | 3.4.0 |
| state | String | Optional. The state of the job group. | 3.4.0 |
| createDate | Timestamp | The time when the job group was created. | 3.4.0 |
| lastOpDate | Timestamp | The time when the job group was last modified. | 3.4.0 |
| jobData | String | The data of the jobs. | 3.4.0 |
| triggersUuid | List | The UUID of the trigger. | 3.4.0 |
SDK Sample
UpdateSchedulerJobGroupAction action = new UpdateSchedulerJobGroupAction();
action.uuid = "4dc1dbf847d733fc98ee2998b5e0eca2";
action.name = "Test2";
action.description = "new test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSchedulerJobGroupAction.Result res = action.call();UpdateSchedulerJobGroupAction action = UpdateSchedulerJobGroupAction()
action.uuid = "4dc1dbf847d733fc98ee2998b5e0eca2"
action.name = "Test2"
action.description = "new test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSchedulerJobGroupAction.Result res = action.call()QuerySchedulerJobGroup
API Request
GET zstack/v1/scheduler/jobgroups
GET zstack/v1/scheduler/jobgroups/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobgroups?q=name=TestJobGroup&q=state=Enabledcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobgroups/c5cb16296a1334d2ac3cd666e1deeca3Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QuerySchedulerJobGroup, and pressing the Tab key.
API Response
{
"inventories": [
{
"uuid": "03dd26d45bb43bb094f3fdec29d78829",
"name": "test",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 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 | 3.4.0 |
| inventories | List | See inventories | 3.4.0 |
| 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. | 3.4.0 |
| description | String | The brief description of the error. | 3.4.0 |
| details | String | The details about the error. | 3.4.0 |
| elaboration | String | The reserved field. Default value: null. | 3.4.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.4.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.4.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the job group. | 3.4.0 |
| name | String | The name of the job group. | 3.4.0 |
| description | String | The detailed description of the job group. | 3.4.0 |
| state | String | Optional. The state of the job group. | 3.4.0 |
| createDate | Timestamp | The time when the job group was created. | 3.4.0 |
| lastOpDate | Timestamp | The time when the job group was last modified. | 3.4.0 |
| jobData | String | The data of the jobs. | 3.4.0 |
| triggersUuid | List | The UUID of the trigger. | 3.4.0 |
SDK Sample
QuerySchedulerJobGroupAction action = new QuerySchedulerJobGroupAction();
action.conditions = asList("name=TestJobGroup","state=Enabled");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySchedulerJobGroupAction.Result res = action.call();QuerySchedulerJobGroupAction action = QuerySchedulerJobGroupAction()
action.conditions = ["name=TestJobGroup","state=Enabled"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySchedulerJobGroupAction.Result res = action.call()AddSchedulerJobsToSchedulerJobGroup
API Request
POST zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/job/{schedulerJobUuids}Authorization: OAuth the-session-uuid{
"params": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/scheduler/jobgroups/280d3a22ab363006b61b4a6c0318056f/job/[ed43fba83eb63a1cacb38c113e2bd38a]| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| schedulerJobGroupUuid | String | url | The UUID of the job group | 3.4.0 | |
| schedulerJobUuids | List | url | The UUID of the job. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
AddSchedulerJobsToSchedulerJobGroupAction action = new AddSchedulerJobsToSchedulerJobGroupAction();
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f";
action.schedulerJobUuids = asList("ed43fba83eb63a1cacb38c113e2bd38a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call();AddSchedulerJobsToSchedulerJobGroupAction action = AddSchedulerJobsToSchedulerJobGroupAction()
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f"
action.schedulerJobUuids = [ed43fba83eb63a1cacb38c113e2bd38a]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call()RemoveSchedulerJobsFromSchedulerJobGroup
API Request
DELETE zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/job/{schedulerJobUuids}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/fa287a3654d330658db1863b8a41a660/job/[24634a04cc45397cb0298258a47ad650]| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| schedulerJobGroupUuid | String | url | The UUID of the job group | 3.4.0 | |
| schedulerJobUuids | List | url | The UUID of the job. | 3.4.0 | |
| systemTags | List | body | Optional. The system tags. | 3.4.0 | |
| userTags | List | body | Optional. The user tags. | 3.4.0 |
API Response
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
RemoveSchedulerJobsFromSchedulerJobGroupAction action = new RemoveSchedulerJobsFromSchedulerJobGroupAction();
action.schedulerJobGroupUuid = "fa287a3654d330658db1863b8a41a660";
action.schedulerJobUuids = asList("24634a04cc45397cb0298258a47ad650");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSchedulerJobsFromSchedulerJobGroupAction.Result res = action.call();RemoveSchedulerJobsFromSchedulerJobGroupAction action = RemoveSchedulerJobsFromSchedulerJobGroupAction()
action.schedulerJobGroupUuid = "fa287a3654d330658db1863b8a41a660"
action.schedulerJobUuids = [24634a04cc45397cb0298258a47ad650]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSchedulerJobsFromSchedulerJobGroupAction.Result res = action.call()QuerySchedulerJobHistory
API Request
GET zstack/v1/scheduler/job/historyAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/job/history?q=schedulerJobGroupUuid=7ae6456c0b01324dae6d4bef358a5772Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QuerySchedulerJobHistory, and pressing the Tab key.
API Response
{
"inventories": [
{
"id": 1.0,
"triggerUuid": "add8c5eea85f41999baff295e47567bc",
"schedulerJobUuid": "d7696913343040d8b98de04d59727711",
"startTime": "Nov 14, 2017 10:20:57 PM",
"executeTime": 900.0,
"targetResourceUuid": "7cd923fa779044fd8510e8ee97aa579e",
"requestDump": "{\"bsUuid\":\"716078c20a0047a69102174c6097a690\"}",
"resultDump": "{\"apiId\":\"f8cf5b6281164e519c0575a73b1b0d9c\",\"success\":true,\"headers\":{},\"id\":\"d70a61ab1b20407c8df94ba7d90be081\",\"createdTime\":1557305707668}",
"success": true
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 3.5.0 |
| inventories | List | See inventories | 3.5.0 |
| 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. | 3.5.0 |
| description | String | The brief description of the error. | 3.5.0 |
| details | String | The details about the error. | 3.5.0 |
| elaboration | String | The reserved field. Default value: null. | 3.5.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.5.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.5.0 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.5.0 | |
| triggerUuid | String | The UUID of the trigger. | 3.5.0 |
| schedulerJobUuid | String | The UUID of the job. | 3.5.0 |
| schedulerJobGroupUuid | String | The UUID of the job group. | 3.5.0 |
| startTime | Timestamp | The time when the job was started. | 3.5.0 |
| executeTime | long | The duration of the job execution. | 3.5.0 |
| targetResourceUuid | String | The UUID of the job execution history. | 3.5.0 |
| requestDump | String | The job execution request. | 3.5.0 |
| resultDump | String | The job execution result. | 3.5.0 |
| success | boolean | 3.5.0 |
SDK Sample
QuerySchedulerJobHistoryAction action = new QuerySchedulerJobHistoryAction();
action.conditions = asList("schedulerJobGroupUuid=7ae6456c0b01324dae6d4bef358a5772");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySchedulerJobHistoryAction.Result res = action.call();QuerySchedulerJobHistoryAction action = QuerySchedulerJobHistoryAction()
action.conditions = ["schedulerJobGroupUuid=7ae6456c0b01324dae6d4bef358a5772"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySchedulerJobHistoryAction.Result res = action.call()GetSchedulerExecutionReport
API Request
GET zstack/v1/scheduler/reportAuthorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/report?startTime=1.5856704E12&intervalTimeUnit=Month&range=4.0&schedulerJobTypes=vmBackup| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| startTime | long | query | The start time when the report ws generated. | 3.9.0 | |
| intervalTimeUnit | String | query | The unit of the interval. |
|
3.9.0 |
| range | int | query | The time range of the report. | 3.9.0 | |
| schedulerJobTypes | List | query | The type of the scheduled job. | 3.9.0 | |
| systemTags | List | query | Optional. The system tags. | 3.9.0 | |
| userTags | List | query | Optional. The user tags. | 3.9.0 |
API Response
{
"successRecords": [
100.0,
99.0,
50.0,
0.0
],
"failureRecords": [
0.0,
1.0,
34.0,
0.0
],
"partialSuccessRecords": [
0.0,
0.0,
16.0,
0.0
],
"waitingRecords": [
0.0,
0.0,
0.0,
100.0
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| successRecords | List | The success records. | 3.9.0 |
| failureRecords | List | The failure records. | 3.9.0 |
| partialSuccessRecords | List | The partial success records. | 3.9.0 |
| waitingRecords | List | The waiting records. | 3.9.0 |
| success | boolean | 3.9.0 | |
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.9.0 |
| error | ErrorCode | See error. | 3.9.0 |
| 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. | 3.9.0 |
| description | String | The brief description of the error. | 3.9.0 |
| details | String | The details about the error. | 3.9.0 |
| elaboration | String | The reserved field. Default value: null. | 3.9.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.9.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.9.0 |
| 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. | 3.9.0 |
| description | String | The brief description of the error. | 3.9.0 |
| details | String | The details about the error. | 3.9.0 |
| elaboration | String | The reserved field. Default value: null. | 3.9.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.9.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.9.0 |
SDK Sample
GetSchedulerExecutionReportAction action = new GetSchedulerExecutionReportAction();
action.startTime = 1.5856704E12;
action.intervalTimeUnit = "Month";
action.range = 4.0;
action.schedulerJobTypes = asList("vmBackup");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetSchedulerExecutionReportAction.Result res = action.call();GetSchedulerExecutionReportAction action = GetSchedulerExecutionReportAction()
action.startTime = 1.5856704E12
action.intervalTimeUnit = "Month"
action.range = 4.0
action.schedulerJobTypes = [vmBackup]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetSchedulerExecutionReportAction.Result res = action.call()