Backup Management Interfaces

CreateVmBackup

Create Virtual Machine Backup

API Request

URLs
POST zstack/v1/volumes/{rootVolumeUuid}/vm-backups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "backupStorageUuid": "fc50c1ece4753c1981e3e3f65a151e0e",
    "name": "backup-1",
    "description": "a critical volume backup"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"backupStorageUuid":"fc50c1ece4753c1981e3e3f65a151e0e","name":"backup-1","description":"a critical volume backup"}}' http://localhost:8080/zstack/v1/volumes/aa6fad9b71af3785a9fdec200bab3ee8/vm-backups
Parameter List
Name Type Location Description Allowed Values Starting Version
rootVolumeUuid String url Root disk UUID 3.0.0
backupStorageUuid String body (included in the params structure) Image Storage UUID 3.0.0
name String body (included in the params structure) Resource name 3.0.0
description (Optional) String body (included in the params structure) Detailed resource description 3.0.0
resourceUuid (Optional) String body (included in the params structure) Optional. The resource UUID. 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0
volumeReadBandwidth (Optional) Long body (included in the params structure) Optional. The volume read bandwidth. 0.6
volumeWriteBandwidth (Optional) Long body (included in the params structure) Optional. The volume write bandwidth. 0.6
networkReadBandwidth (Optional) Long body (included in the params structure) Optional. The network read bandwidth. 0.6
networkWriteBandwidth (Optional) Long body (included in the params structure) Optional. The network write bandwidth. 0.6
mode (Optional) String body (included in the params structure) Optional. The mode.
  • full
0.6
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4.0

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "785edb93bb1b3a31857dac1e69cc8392",
      "volumeUuid": "2ae6b881bb1239cd907d48993e86a2e8",
      "name": "Root-Volume-Backup-1",
      "description": "volume backup",
      "size": 1073741824,
      "groupUuid": "2f7c0a5bb86430e8a5ac48312172d70d",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {
      "uuid": "3084eea905f4311b9d484bfe97142bdf",
      "volumeUuid": "f6c7d5276c873eba8accddd4a09a1ee6",
      "name": "Data-Volume-Backup-1",
      "description": "volume backup",
      "size": 2147483648,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ],
  "actualExecuteTime": 60
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.0.0
inventories List For details, see inventories 3.0.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventories
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
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();
Python SDK
action = CreateVmBackupAction()
action.rootVolumeUuid = "aa6fad9b71af3785a9fdec200bab3ee8"
action.backupStorageUuid = "fc50c1ece4753c1981e3e3f65a151e0e"
action.name = "backup-1"
action.description = "a critical volume backup"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteVmBackup

API Request

URLs
DELETE zstack/v1/vm-backups/{groupUuid}?backupStorageUuids={backupStorageUuids}&deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/vm-backups/92046c016d7c3af7bdd4a5077fb91450?backupStorageUuids=255fc896605f3237a22940fa92d8670b&deleteMode=Permissive
Parameter List
Name Type Location Description Allowed Values Starting Version
groupUuid String url Backup group UUID 3.0.0
backupStorageUuids (Optional) List url Image Storage UUID list 3.0.0
deleteMode (Optional) String url Optional. The delete mode. 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
DeleteVmBackupAction action = new DeleteVmBackupAction();
action.groupUuid = "92046c016d7c3af7bdd4a5077fb91450";
action.backupStorageUuids = asList("255fc896605f3237a22940fa92d8670b");
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteVmBackupAction.Result res = action.call();
Python SDK
DeleteVmBackupAction action = DeleteVmBackupAction()
action.groupUuid = "92046c016d7c3af7bdd4a5077fb91450"
action.backupStorageUuids = [255fc896605f3237a22940fa92d8670b]
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteVmBackupAction.Result res = action.call()

SyncVmBackup

API Request

URLs
PUT zstack/v1/vm-backups/imageStore/{imageStoreUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncVmBackup": {},
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncVmBackup":{}}' http://localhost:8080/zstack/v1/vm-backups/imageStore/087b41055fbc4875aef622142cbe5ac3/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
imageStoreUuid String url Backup server UUID 3.5.0
systemTags (Optional) List body Optional. The system tags. 3.5.0
userTags (Optional) List body Optional. The user tags. 3.5.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
SyncVmBackupAction action = new SyncVmBackupAction();
action.imageStoreUuid = "7c3e52e35de449c9abc1343c83b93cd5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVmBackupAction.Result res = action.call();
Python SDK
SyncVmBackupAction action = SyncVmBackupAction()
action.imageStoreUuid = "07270eb0ae25428586b224c33e88e485"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncVmBackupAction.Result res = action.call()

CreateVmFromVmBackup

Create Virtual Machine From Virtual Machine Backup

API Request

URLs
POST zstack/v1/vm-instances/from/vm-backups/{groupUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "vm1",
    "instanceOfferingUuid": "7d608371542b3ab5960823c1b57bfa0c",
    "l3NetworkUuids": [
      "6ab4d28582d232708ed2912c1c3eb1ef"
    ],
    "clusterUuid": "84a216b8b0323b87bf9d2b32abc635a3",
    "description": "this is a vm",
    "diskAOs": [
      {
        "boot": false,
        "primaryStorageUuid": "2b7a5bd210ed3b1ea9d746f714a79eaf",
        "size": 0,
        "sourceUuid": "b205ac85f069349eafe837afadd173df",
        "volumeBackupTemplate": false
      }
    ],
    "strategy": "InstantStart"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"name":"vm1","instanceOfferingUuid":"7d608371542b3ab5960823c1b57bfa0c","l3NetworkUuids":["6ab4d28582d232708ed2912c1c3eb1ef"],"clusterUuid":"84a216b8b0323b87bf9d2b32abc635a3","description":"this is a vm","diskAOs":[{"boot":false,"primaryStorageUuid":"2b7a5bd210ed3b1ea9d746f714a79eaf","size":0,"sourceUuid":"b205ac85f069349eafe837afadd173df","volumeBackupTemplate":false}],"strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/vm-instances/from/vm-backups/04ac2beae2b03def881dea125299498c
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Resource name 3.0.0
groupUuid String url Virtual machine backup group UUID 3.0.0
backupStorageUuid (Optional) String body (included in the params structure) Image Storage UUID 0.6
instanceOfferingUuid (Optional) String body (included in the params structure) Instance Offering UUID 3.0.0
l3NetworkUuids (Optional) List body (included in the params structure) A list of Distributed Port Group UUIDs 3.0.0
vmNicParams (Optional) String body (included in the params structure) NIC information 3.17.0
type (Optional) String body (included in the params structure) Virtual Machine type
  • UserVm
  • ApplianceVm
3.0.0
zoneUuid (Optional) String body (included in the params structure) Data Center UUID 3.0.0
clusterUuid (Optional) String body (included in the params structure) Cluster UUID 3.0.0
hostUuid (Optional) String body (included in the params structure) Host UUID 3.0.0
primaryStorageUuidForRootVolume (Optional) String body (included in the params structure) Root disk data storage UUID 3.0.0
primaryStorageUuidForDataVolume (Optional) String body (included in the params structure) Data disk data storage UUID 3.0.0
description (Optional) String body (included in the params structure) Detailed resource description 3.0.0
rootVolumeSystemTags (Optional) List body (included in the params structure) Root disk system tags 3.0.0
dataVolumeSystemTags (Optional) List body (included in the params structure) Data disk system tags 3.0.0
diskAOs (Optional) List body (included in the params structure) Parameters specified for individual disks. DiskAO.sourceUuid is bound to the UUID of the original disk corresponding to the backup (VolumeBackupVO.volumeUuid). You can separately specify primaryStorageUuid, systemTags, and other parameters for each disk. Note: diskAOs is mutually exclusive with primaryStorageUuidForRootVolume/primaryStorageUuidForDataVolume and rootVolumeSystemTags/dataVolumeSystemTags. They cannot be specified at the same time 5.0.0
defaultL3NetworkUuid (Optional) String body (included in the params structure) UUID of the default distributed port group 3.0.0
resourceUuid (Optional) String body (included in the params structure) Optional. The resource UUID. 3.0.0
systemTags (Optional) List body System tags 3.0.0
userTags (Optional) List body User tags 3.0.0
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4.0
strategy (Optional) String body (included in the params structure) Virtual machine creation strategy
  • InstantStart
  • JustCreate
  • CreateStopped
4.10.0
cpuNum (Optional) Integer body (included in the params structure) Optional. The number of CPUs. zsv 4.3.0
memorySize (Optional) Long body (included in the params structure) Optional. The memory size. zsv 4.3.0
reservedMemorySize (Optional) Long body (included in the params structure) Optional. The reserved memory size. zsv 4.3.0
vmEncryption (Optional) Boolean body (included in the params structure) Whether the virtual machine is encrypted 5.1.0

API Response

Response Example
{
  "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": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "9856d36e40783d669b9e4f1de41d1a17",
        "vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
        "usedIpUuid": "be02105c2a223492a91fb09ba664ecb1",
        "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,
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "24b9fcb69f123ad6b3ddfffed96d2882",
        "name": "Root-Volume-For-VM-a1c07d683f693f6e9f2d7f9a499c7840",
        "primaryStorageUuid": "ae47a25fd7cf3a349035d01060a8a224",
        "vmInstanceUuid": "a1c07d683f693f6e9f2d7f9a499c7840",
        "rootImageUuid": "5c07704333c532e8b402b6b3ddb89315",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-24b9fcb69f123ad6b3ddfffed96d2882/24b9fcb69f123ad6b3ddfffed96d2882.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 0.6
inventory VmInstanceInventory For details, see inventory 3.0.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 0.6
name String Resource name 0.6
description String Detailed resource description 0.6
zoneUuid String Data Center UUID 0.6
clusterUuid String Cluster UUID 0.6
imageUuid String Image UUID 0.6
hostUuid String Host UUID 0.6
lastHostUuid String Last Host UUID 0.6
instanceOfferingUuid String Instance Offering UUID 0.6
rootVolumeUuid String Root disk UUID 0.6
platform String Virtual Machine platform type, Windows / Linux / Other 0.6
architecture String Virtual Machine architecture, x86_64 / aarch64 / Other 0.6
defaultL3NetworkUuid String Default Distributed Port Group UUID 0.6
type String Virtual Machine type, User virtual machine or platform special purpose virtual machine 0.6
hypervisorType String Virtual Machine hypervisor type, typically KVM 0.6
memorySize Long Memory size 0.6
cpuNum Integer CPU number 0.6
cpuSpeed Long CPU speed 0.6
allocatorStrategy String Virtual Machine allocation strategy 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6
state String Virtual Machine enabled state 0.6
guestOsType String Virtual Machine host operating system type 3.11.2
vmNics List For details, see vmNics 0.6
allVolumes List For details, see allVolumes 0.6
vmCdRoms List For details, see vmCdRoms 0.6
#vmNics
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
l3NetworkUuid String Distributed Port Group UUID 3.17.13
ip String The IP address. 3.17.13
mac String The MAC address. 3.17.13
hypervisorType String The hypervisor type. 3.17.13
netmask String The netmask. 3.17.13
gateway String The gateway IP address. 3.17.13
metaData String The metadata. 3.17.13
ipVersion Integer The IP version. 3.17.13
driverType String The driver type. 3.17.13
internalName String The internal name. 3.17.13
deviceId Integer The device ID. 3.17.13
type String The resource type. 3.17.13
state String NIC Status 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
usedIps List For details, see usedIps 3.17.13
#usedIps
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 4.10.0
ipRangeUuid String IP Range UUID 4.10.0
l3NetworkUuid String Distributed Port Group UUID 4.10.0
ipVersion Integer IP protocol number 4.10.0
ip String IP address 4.10.0
netmask String Subnet mask 4.10.0
gateway String Gateway address 4.10.0
usedFor String Allocation reason 4.10.0
ipInLong long Long stored IP address, only valid for ipv4 4.10.0
vmNicUuid String Virtual Machine NIC UUID 4.10.0
createDate Timestamp Creation time 4.10.0
lastOpDate Timestamp Last modification time 4.10.0
#allVolumes
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0
#vmCdRoms
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
deviceId Integer The device ID. 3.17.13
isoUuid String The ISO UUID. 3.17.13
isoInstallPath String The ISO install path. 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13

SDK Examples

Java SDK
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.diskAOs = asList([boot:false, primaryStorageUuid:2b7a5bd210ed3b1ea9d746f714a79eaf, size:0, sourceUuid:b205ac85f069349eafe837afadd173df, volumeBackupTemplate:false]);
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromVmBackupAction.Result res = action.call();
Python SDK
action = CreateVmFromVmBackupAction()
action.name = "vm1"
action.groupUuid = "04ac2beae2b03def881dea125299498c"
action.instanceOfferingUuid = "7d608371542b3ab5960823c1b57bfa0c"
action.l3NetworkUuids = [6ab4d28582d232708ed2912c1c3eb1ef]
action.clusterUuid = "84a216b8b0323b87bf9d2b32abc635a3"
action.description = "this is a vm"
action.diskAOs = [[boot:false, primaryStorageUuid:2b7a5bd210ed3b1ea9d746f714a79eaf, size:0, sourceUuid:b205ac85f069349eafe837afadd173df, volumeBackupTemplate:false]]
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateVmFromVolumeBackup

Create Virtual Machine From Disk Backup

API Request

URLs
POST zstack/v1/vm-instances/from/vm-backup/{backupUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "vm1",
    "instanceOfferingUuid": "31d2057b670d3c32a6970e519b514f12",
    "l3NetworkUuids": [
      "87b522f02ef83627bcab5e427ba2d5e6"
    ],
    "clusterUuid": "255b14070a533fb5ad9a845d4c50508a",
    "description": "this is a vm",
    "strategy": "InstantStart"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"name":"vm1","instanceOfferingUuid":"31d2057b670d3c32a6970e519b514f12","l3NetworkUuids":["87b522f02ef83627bcab5e427ba2d5e6"],"clusterUuid":"255b14070a533fb5ad9a845d4c50508a","description":"this is a vm","strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/vm-instances/from/vm-backup/b3ecd20a4b523ff0b5a954a8579a1aeb
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Virtual machine name 3.18.0
backupUuid String url Backup UUID 3.18.0
backupStorageUuid (Optional) String body (included in the params structure) Image Storage UUID 3.18.0
instanceOfferingUuid (Optional) String body (included in the params structure) Instance Offering UUID 3.18.0
cpuNum (Optional) Integer body (included in the params structure) Number of virtual machine CPU cores 4.10.28
memorySize (Optional) Long body (included in the params structure) Virtual machine memory size, in bytes 4.10.28
defaultL3NetworkUuid (Optional) String body (included in the params structure) Default distributed port group UUID 3.18.0
l3NetworkUuids List body (included in the params structure) A list of Distributed Port Group UUIDs 3.18.0
type (Optional) String body (included in the params structure) Virtual Machine type
  • UserVm
  • ApplianceVm
3.18.0
zoneUuid (Optional) String body (included in the params structure) Data Center UUID 3.18.0
clusterUuid (Optional) String body (included in the params structure) Cluster UUID 3.18.0
hostUuid (Optional) String body (included in the params structure) Host UUID 3.18.0
primaryStorageUuidForRootVolume (Optional) String body (included in the params structure) Root disk data storage UUID 3.18.0
description (Optional) String body (included in the params structure) Detailed resource description 3.18.0
rootVolumeSystemTags (Optional) List body (included in the params structure) Root disk system tags 3.18.0
resourceUuid (Optional) String body (included in the params structure) Resource UUID 3.18.0
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.18.0
systemTags (Optional) List body System tags 3.18.0
userTags (Optional) List body User tags 3.18.0
strategy (Optional) String body (included in the params structure) Virtual machine creation strategy
  • InstantStart
  • JustCreate
  • CreateStopped
4.10.0
resetTpm (Optional) Boolean body (included in the params structure) Whether to reset the TPM state of the virtual machine to be created 5.0.0

API Response

Response Example
{
  "inventory": {
    "uuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
    "name": "Test-VM",
    "description": "web server VM",
    "zoneUuid": "1086a7491b8c3fb9ab12192dc0fab906",
    "clusterUuid": "3e368e7f98913ec6bb20d6cc969cf50a",
    "imageUuid": "2ceb7086482d3b42ab56b9daa6fb4d44",
    "hostUuid": "d81f8599fd033183ab2d4bcafce233cc",
    "lastHostUuid": "2d9fd9b480be3fdd9df46548d9d178d5",
    "instanceOfferingUuid": "feba03817e0e326d827ebdb436786bad",
    "rootVolumeUuid": "2f368d0d8b4734b7b58e1c5cb2ec27c6",
    "platform": "Linux",
    "defaultL3NetworkUuid": "ecebe1b81b18351dbdf304622e9ada80",
    "type": "UserVm",
    "hypervisorType": "KVM",
    "memorySize": 8589934592,
    "cpuNum": 1,
    "allocatorStrategy": "LastHostPreferredAllocatorStrategy",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "state": "Running",
    "vmNics": [
      {
        "uuid": "da1e1002fa2b387bbe389ce3bf10ba92",
        "vmInstanceUuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
        "usedIpUuid": "e8c56c6711e83896acb7413183726c1c",
        "l3NetworkUuid": "ecebe1b81b18351dbdf304622e9ada80",
        "ip": "192.168.1.10",
        "mac": "00:0c:29:bd:99:fc",
        "netmask": "255.255.255.0",
        "gateway": "192.168.1.1",
        "deviceId": 0,
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "allVolumes": [
      {
        "uuid": "2f368d0d8b4734b7b58e1c5cb2ec27c6",
        "name": "Root-Volume-For-VM-0a2cbf2edacc399cb9a7e6b2fa14602d",
        "primaryStorageUuid": "890196bf1b5a308da1c75eb61ff441a3",
        "vmInstanceUuid": "0a2cbf2edacc399cb9a7e6b2fa14602d",
        "rootImageUuid": "2ceb7086482d3b42ab56b9daa6fb4d44",
        "installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-2f368d0d8b4734b7b58e1c5cb2ec27c6/2f368d0d8b4734b7b58e1c5cb2ec27c6.qcow2",
        "type": "Root",
        "format": "qcow2",
        "size": 107374182400,
        "actualSize": 21474836480,
        "deviceId": 0,
        "state": "Enabled",
        "status": "Ready",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ]
  }
}
Name Type Description Starting Version
success boolean Whether the request succeeded 3.18.0
inventory VmInstanceInventory For details, see inventory 3.18.0
error ErrorCode For details, see error 3.18.0
#inventory
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 0.6
name String Resource name 0.6
description String Detailed resource description 0.6
zoneUuid String Data Center UUID 0.6
clusterUuid String Cluster UUID 0.6
imageUuid String Image UUID 0.6
hostUuid String Host UUID 0.6
lastHostUuid String Last Host UUID 0.6
instanceOfferingUuid String Instance Offering UUID 0.6
rootVolumeUuid String Root disk UUID 0.6
platform String Virtual Machine platform type, Windows / Linux / Other 0.6
architecture String Virtual Machine architecture, x86_64 / aarch64 / Other 0.6
defaultL3NetworkUuid String Default Distributed Port Group UUID 0.6
type String Virtual Machine type, User virtual machine or platform special purpose virtual machine 0.6
hypervisorType String Virtual Machine hypervisor type, typically KVM 0.6
memorySize Long Memory size 0.6
cpuNum Integer CPU number 0.6
cpuSpeed Long CPU speed 0.6
allocatorStrategy String Virtual Machine allocation strategy 0.6
createDate Timestamp Creation time 0.6
lastOpDate Timestamp Last modification time 0.6
state String Virtual Machine enabled state 0.6
guestOsType String Virtual Machine host operating system type 3.11.2
vmNics List For details, see vmNics 0.6
allVolumes List For details, see allVolumes 0.6
vmCdRoms List For details, see vmCdRoms 0.6
#vmNics
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
l3NetworkUuid String Distributed Port Group UUID 3.17.13
ip String The IP address. 3.17.13
mac String The MAC address. 3.17.13
hypervisorType String The hypervisor type. 3.17.13
netmask String The netmask. 3.17.13
gateway String The gateway IP address. 3.17.13
metaData String The metadata. 3.17.13
ipVersion Integer The IP version. 3.17.13
driverType String The driver type. 3.17.13
internalName String The internal name. 3.17.13
deviceId Integer The device ID. 3.17.13
type String The resource type. 3.17.13
state String NIC Status 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
usedIps List For details, see usedIps 3.17.13
#usedIps
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 4.10.0
ipRangeUuid String IP Range UUID 4.10.0
l3NetworkUuid String Distributed Port Group UUID 4.10.0
ipVersion Integer IP protocol number 4.10.0
ip String IP address 4.10.0
netmask String Subnet mask 4.10.0
gateway String Gateway address 4.10.0
usedFor String Allocation reason 4.10.0
ipInLong long Long stored IP address, only valid for ipv4 4.10.0
vmNicUuid String Virtual Machine NIC UUID 4.10.0
createDate Timestamp Creation time 4.10.0
lastOpDate Timestamp Last modification time 4.10.0
#allVolumes
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
primaryStorageUuid String Data Storage UUID 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
diskOfferingUuid String Disk Offering UUID 3.17.13
rootImageUuid String The root image UUID. 3.17.13
installPath String The installation path. 3.17.13
type String The resource type. 3.17.13
format String The format. 3.17.13
size Long The size. 3.17.13
actualSize Long The actual size. 3.17.13
deviceId Integer The device ID. 3.17.13
state String The resource state. 3.17.13
status String The resource status. 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
isShareable Boolean Whether the resource is shareable. 3.17.13
volumeQos String The volume QoS. 3.17.13
lastDetachDate Timestamp The last detach date. 3.17.13
lastVmInstanceUuid String The last VM instance UUID. 3.17.13
encrypted Boolean Whether the resource is encrypted. 5.1.0
#vmCdRoms
Name Type Description Starting Version
uuid String Resource UUID, which uniquely identifies the resource 3.17.13
vmInstanceUuid String Virtual Machine UUID 3.17.13
deviceId Integer The device ID. 3.17.13
isoUuid String The ISO UUID. 3.17.13
isoInstallPath String The ISO install path. 3.17.13
name String Resource name 3.17.13
description String Detailed resource description 3.17.13
createDate Timestamp Creation time 3.17.13
lastOpDate Timestamp Last modification time 3.17.13
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6

SDK Examples

Java SDK
CreateVmFromVolumeBackupAction action = new CreateVmFromVolumeBackupAction();
action.name = "vm1";
action.backupUuid = "b3ecd20a4b523ff0b5a954a8579a1aeb";
action.instanceOfferingUuid = "31d2057b670d3c32a6970e519b514f12";
action.l3NetworkUuids = asList("87b522f02ef83627bcab5e427ba2d5e6");
action.clusterUuid = "255b14070a533fb5ad9a845d4c50508a";
action.description = "this is a vm";
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromVolumeBackupAction.Result res = action.call();
Python SDK
action = CreateVmFromVolumeBackupAction()
action.name = "vm1"
action.backupUuid = "b3ecd20a4b523ff0b5a954a8579a1aeb"
action.instanceOfferingUuid = "31d2057b670d3c32a6970e519b514f12"
action.l3NetworkUuids = [87b522f02ef83627bcab5e427ba2d5e6]
action.clusterUuid = "255b14070a533fb5ad9a845d4c50508a"
action.description = "this is a vm"
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateDataVolumeFromVolumeBackup

Create Data Disk From Disk Backup

API Request

URLs
POST zstack/v1/volumes/data-volume/from/volume-template/{backupUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "vm1",
    "vmInstanceUuid": "df47f06e78bb381eb278f5f6bcc101b2",
    "backupStorageUuid": "dd5aec0fdb7c32f3bcfb526dcbe65722",
    "primaryStorageUuid": "7fe66ccbc8cc3d19a15ad7188c17374b"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"name":"vm1","vmInstanceUuid":"df47f06e78bb381eb278f5f6bcc101b2","backupStorageUuid":"dd5aec0fdb7c32f3bcfb526dcbe65722","primaryStorageUuid":"7fe66ccbc8cc3d19a15ad7188c17374b"}}' http://localhost:8080/zstack/v1/volumes/data-volume/from/volume-template/5ac65bdd607d32a4900fe3f6694ddc95
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Data disk name 3.18.0
vmUuid String body (included in the params structure) Virtual Machine UUID 3.18.0
backupUuid String url Backup UUID 3.18.0
backupStorageUuid (Optional) String body (included in the params structure) Backup server UUID 3.18.0
primaryStorageUuid (Optional) String body (included in the params structure) Data Storage UUID 3.18.0
description (Optional) String body (included in the params structure) Detailed resource description 3.18.0
resourceUuid (Optional) String body (included in the params structure) Resource UUID 3.18.0
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.18.0
systemTags (Optional) List body System tags 3.18.0
userTags (Optional) List body User tags 3.18.0

API Response

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

SDK Examples

Java SDK
CreateDataVolumeFromVolumeBackupAction action = new CreateDataVolumeFromVolumeBackupAction();
action.name = "vm1";
action.vmInstanceUuid = "df47f06e78bb381eb278f5f6bcc101b2";
action.backupUuid = "5ac65bdd607d32a4900fe3f6694ddc95";
action.backupStorageUuid = "dd5aec0fdb7c32f3bcfb526dcbe65722";
action.primaryStorageUuid = "7fe66ccbc8cc3d19a15ad7188c17374b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeFromVolumeBackupAction.Result res = action.call();
Python SDK
action = CreateDataVolumeFromVolumeBackupAction()
action.name = "vm1"
action.vmInstanceUuid = "df47f06e78bb381eb278f5f6bcc101b2"
action.backupUuid = "5ac65bdd607d32a4900fe3f6694ddc95"
action.backupStorageUuid = "dd5aec0fdb7c32f3bcfb526dcbe65722"
action.primaryStorageUuid = "7fe66ccbc8cc3d19a15ad7188c17374b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateVolumeBackup

Create Disk Backup

API Request

URLs
POST zstack/v1/volumes/{volumeUuid}/volume-backups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "backupStorageUuid": "eb346a99797a3ad19bae298d2b67be5f",
    "name": "backup-1",
    "description": "a critical volume backup"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X POST -d '{"params":{"backupStorageUuid":"eb346a99797a3ad19bae298d2b67be5f","name":"backup-1","description":"a critical volume backup"}}' http://localhost:8080/zstack/v1/volumes/deda5c7823b930b198052fd1a7dfae78/volume-backups
Parameter List
Name Type Location Description Allowed Values Starting Version
volumeUuid String url Disk UUID 2.6
backupStorageUuid String body (included in the params structure) Image Storage UUID 2.6
name String body (included in the params structure) Resource name 2.6
description (Optional) String body (included in the params structure) Detailed resource description 2.6
resourceUuid (Optional) String body (included in the params structure) Specified resource UUID 2.6
systemTags (Optional) List body System tags 2.6
userTags (Optional) List body User tags 2.6
volumeReadBandwidth (Optional) Long body (included in the params structure) Optional. The volume read bandwidth. 0.6
volumeWriteBandwidth (Optional) Long body (included in the params structure) Optional. The volume write bandwidth. 0.6
networkReadBandwidth (Optional) Long body (included in the params structure) Optional. The network read bandwidth. 0.6
networkWriteBandwidth (Optional) Long body (included in the params structure) Optional. The network write bandwidth. 0.6
mode (Optional) String body (included in the params structure) Optional. The mode.
  • full
0.6
tagUuids (Optional) List body (included in the params structure) Tag UUID list 3.4.0

API Response

Response Example
{
  "inventory": {
    "uuid": "dc64d9ac1b6f30e0aaa398b1f82e10f7",
    "volumeUuid": "12a5e7fe96c73fa6812cd4dba80c0df7",
    "name": "Backup-1",
    "description": "volume backup",
    "size": 1073741824,
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  },
  "actualExecuteTime": 60
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 2.6
inventory VolumeBackupInventory For details, see inventory 2.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
CreateVolumeBackupAction action = new CreateVolumeBackupAction();
action.volumeUuid = "deda5c7823b930b198052fd1a7dfae78";
action.backupStorageUuid = "eb346a99797a3ad19bae298d2b67be5f";
action.name = "backup-1";
action.description = "a critical volume backup";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVolumeBackupAction.Result res = action.call();
Python SDK
action = CreateVolumeBackupAction()
action.volumeUuid = "deda5c7823b930b198052fd1a7dfae78"
action.backupStorageUuid = "eb346a99797a3ad19bae298d2b67be5f"
action.name = "backup-1"
action.description = "a critical volume backup"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryVolumeBackup

Query Disk Backup

API Request

URLs
GET zstack/v1/volume-backups
GET zstack/v1/volume-backups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/volume-backups?q=uuid=51220c98d9173f97b63be7eb9216f96e
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/volume-backups/09de4206bb143d75aad644c88cdbb364

Queryable Fields

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

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "becd24d9ab613bf2bca69392d168c3d7",
      "volumeUuid": "10d2016486e834abb871d1e03b85a45b",
      "name": "backup-2",
      "description": "my backup",
      "size": 1310720,
      "encrypted": false
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 2.6
inventories List For details, see inventories 0.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventories
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

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

RecoverBackupFromImageStoreBackupStorage

Recover Backup From Image Store Backup Storage

API Request

URLs
PUT zstack/v1/volume-backups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "recoverBackupFromImageStoreBackupStorage": {
    "srcBackupStorageUuid": "98156e94f6463740908e8b963a64a89f",
    "dstBackupStorageUuid": "dbe16164d9cc3ab5a79e6596841f55af"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"recoverBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"98156e94f6463740908e8b963a64a89f","dstBackupStorageUuid":"dbe16164d9cc3ab5a79e6596841f55af"}}' http://localhost:8080/zstack/v1/volume-backups/46081ffd1ceb3747be948925bcf6d272/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the disk backup. Uniquely identifies the resource 2.6
srcBackupStorageUuid String body (included in the recoverBackupFromImageStoreBackupStorage structure) UUID of the image server that receives the recovered disk 2.6
dstBackupStorageUuid String body (included in the recoverBackupFromImageStoreBackupStorage structure) UUID of the image server used for recovery 2.6
systemTags (Optional) List body System tags 2.6
userTags (Optional) List body System tags 2.6

API Response

Response Example
{
  "inventory": {
    "uuid": "1ca8a996e1583dbf8fdb22eb7c5a7720",
    "volumeUuid": "4dcfee4974d7326f8667a26ca4990953",
    "name": "Backup-1",
    "description": "volume backup",
    "size": 1073741824,
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 2.6
inventory VolumeBackupInventory For details, see inventory 2.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
RecoverBackupFromImageStoreBackupStorageAction action = new RecoverBackupFromImageStoreBackupStorageAction();
action.uuid = "46081ffd1ceb3747be948925bcf6d272";
action.srcBackupStorageUuid = "98156e94f6463740908e8b963a64a89f";
action.dstBackupStorageUuid = "dbe16164d9cc3ab5a79e6596841f55af";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverBackupFromImageStoreBackupStorageAction.Result res = action.call();
Python SDK
action = RecoverBackupFromImageStoreBackupStorageAction()
action.uuid = "46081ffd1ceb3747be948925bcf6d272"
action.srcBackupStorageUuid = "98156e94f6463740908e8b963a64a89f"
action.dstBackupStorageUuid = "dbe16164d9cc3ab5a79e6596841f55af"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SyncBackupFromImageStoreBackupStorage

Sync Backup From Image Store Backup Storage

API Request

URLs
PUT zstack/v1/volume-backups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncBackupFromImageStoreBackupStorage": {
    "srcBackupStorageUuid": "4ca933ae060a3c1ba520ba6b20ac3230",
    "dstBackupStorageUuid": "738ef8a48f533dafb0b27fc0ba1bc22e"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"syncBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"4ca933ae060a3c1ba520ba6b20ac3230","dstBackupStorageUuid":"738ef8a48f533dafb0b27fc0ba1bc22e"}}' http://localhost:8080/zstack/v1/volume-backups/3b77720e739e3f9b87ca0beb6f45f5a5/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the disk backup. Uniquely identifies the resource 2.6
srcBackupStorageUuid String body (included in the syncBackupFromImageStoreBackupStorage structure) Source image server 2.6
dstBackupStorageUuid String body (included in the syncBackupFromImageStoreBackupStorage structure) Destination image server 2.6
systemTags (Optional) List body System tags 2.6
userTags (Optional) List body User tags 2.6

API Response

Response Example
{
  "inventory": {
    "uuid": "3f49e7470a0935a0b0d3088e406b1df7",
    "volumeUuid": "43715d2428ce32d48deac117d32fa945",
    "name": "Backup-1",
    "description": "volume backup",
    "size": 1073741824,
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 2.6
inventory VolumeBackupInventory For details, see inventory 2.6
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventory
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
SyncBackupFromImageStoreBackupStorageAction action = new SyncBackupFromImageStoreBackupStorageAction();
action.uuid = "3b77720e739e3f9b87ca0beb6f45f5a5";
action.srcBackupStorageUuid = "4ca933ae060a3c1ba520ba6b20ac3230";
action.dstBackupStorageUuid = "738ef8a48f533dafb0b27fc0ba1bc22e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncBackupFromImageStoreBackupStorageAction.Result res = action.call();
Python SDK
action = SyncBackupFromImageStoreBackupStorageAction()
action.uuid = "3b77720e739e3f9b87ca0beb6f45f5a5"
action.srcBackupStorageUuid = "4ca933ae060a3c1ba520ba6b20ac3230"
action.dstBackupStorageUuid = "738ef8a48f533dafb0b27fc0ba1bc22e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RevertVmFromVmBackup

API Request

URLs
PUT zstack/v1/vm-backups/{groupUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "revertVmFromVmBackup": {
    "backupStorageUuid": "99afb6149155396c8ac1b6ab62badb9d",
    "strategy": "CreateStopped"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revertVmFromVmBackup":{"backupStorageUuid":"99afb6149155396c8ac1b6ab62badb9d","strategy":"CreateStopped"}}' \
http://localhost:8080/zstack/v1/vm-backups/39f4e3c4b7553dbc98b8c0ce0e8f82a1/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
groupUuid String url Backup group UUID 3.0.0
backupStorageUuid (Optional) String body (Contained in the revertVmFromVmBackup structure) Image Storage UUID 3.0.0
strategy (Optional) String body (Contained in the revertVmFromVmBackup structure) Optional. The strategy.
  • InstantStart
  • JustCreate
  • CreateStopped
4.3.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
RevertVmFromVmBackupAction action = new RevertVmFromVmBackupAction();
action.groupUuid = "39f4e3c4b7553dbc98b8c0ce0e8f82a1";
action.backupStorageUuid = "99afb6149155396c8ac1b6ab62badb9d";
action.strategy = "CreateStopped";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevertVmFromVmBackupAction.Result res = action.call();
Python SDK
RevertVmFromVmBackupAction action = RevertVmFromVmBackupAction()
action.groupUuid = "39f4e3c4b7553dbc98b8c0ce0e8f82a1"
action.backupStorageUuid = "99afb6149155396c8ac1b6ab62badb9d"
action.strategy = "CreateStopped"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevertVmFromVmBackupAction.Result res = action.call()

RecoverVmBackupFromImageStoreBackupStorage

Recover Virtual Machine Backup From Image Store Backup Storage

API Request

URLs
PUT zstack/v1/vm-backups/{groupUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "recoverVmBackupFromImageStoreBackupStorage": {
    "srcBackupStorageUuid": "c63b10a638f6302caeabb7a806d087ad",
    "dstBackupStorageUuid": "7c7d653af1c531dfa04dabea3a085de5"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"recoverVmBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"c63b10a638f6302caeabb7a806d087ad","dstBackupStorageUuid":"7c7d653af1c531dfa04dabea3a085de5"}}' http://localhost:8080/zstack/v1/vm-backups/7913ce9f37973f4e8339aea4ff61584c/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
groupUuid String url Virtual machine backup group UUID 3.0.0
srcBackupStorageUuid String body (included in the recoverVmBackupFromImageStoreBackupStorage structure) Local Image Storage 3.0.0
dstBackupStorageUuid String body (included in the recoverVmBackupFromImageStoreBackupStorage structure) Backup Image Storage 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "5e28a0c27a8e352bbeedff94a0326f9e",
      "volumeUuid": "aa5fbdba3ffa352bbefaf913f56949f3",
      "name": "Root-Volume-Backup-1",
      "description": "volume backup",
      "size": 1073741824,
      "groupUuid": "0150a8120f9334db8e9abc9d3f5eea08",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {
      "uuid": "5924c90ddbcb3784ae6e78b70ede90ce",
      "volumeUuid": "12d583f519f03a0593dff7514af65be4",
      "name": "Data-Volume-Backup-1",
      "description": "volume backup",
      "size": 2147483648,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.0.0
inventories List For details, see inventories 3.0.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventories
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
RecoverVmBackupFromImageStoreBackupStorageAction action = new RecoverVmBackupFromImageStoreBackupStorageAction();
action.groupUuid = "7913ce9f37973f4e8339aea4ff61584c";
action.srcBackupStorageUuid = "c63b10a638f6302caeabb7a806d087ad";
action.dstBackupStorageUuid = "7c7d653af1c531dfa04dabea3a085de5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverVmBackupFromImageStoreBackupStorageAction.Result res = action.call();
Python SDK
action = RecoverVmBackupFromImageStoreBackupStorageAction()
action.groupUuid = "7913ce9f37973f4e8339aea4ff61584c"
action.srcBackupStorageUuid = "c63b10a638f6302caeabb7a806d087ad"
action.dstBackupStorageUuid = "7c7d653af1c531dfa04dabea3a085de5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SyncVmBackupFromImageStoreBackupStorage

Sync Virtual Machine Backup From Image Store Backup Storage

API Request

URLs
PUT zstack/v1/vm-backups/{groupUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncVmBackupFromImageStoreBackupStorage": {
    "srcBackupStorageUuid": "3428f7d03e493f89b32c57ef80a7e5af",
    "dstBackupStorageUuid": "6f8c528537a9347a86da7a96fb7418d4"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are shown to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X PUT -d '{"syncVmBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"3428f7d03e493f89b32c57ef80a7e5af","dstBackupStorageUuid":"6f8c528537a9347a86da7a96fb7418d4"}}' http://localhost:8080/zstack/v1/vm-backups/14e53ad2aecd3e7ebe1f05cb4f5dd6a5/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
groupUuid String url Backup group UUID 3.0.0
srcBackupStorageUuid String body (included in the syncVmBackupFromImageStoreBackupStorage structure) Local Image Storage 3.0.0
dstBackupStorageUuid String body (included in the syncVmBackupFromImageStoreBackupStorage structure) Backup Image Storage 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "inventories": [
    {
      "uuid": "cf59b77253e134e483ceda7e21c6bf15",
      "volumeUuid": "6be74434a84e3c939830a3987488a499",
      "name": "Root-Volume-Backup-1",
      "description": "volume backup",
      "size": 1073741824,
      "groupUuid": "09d5949ca5f233c2adcf4c278f537cef",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {
      "uuid": "c546170919a4300e9b3d3e29fc27de7f",
      "volumeUuid": "39656103b9e7391e89071517f9d21b91",
      "name": "Data-Volume-Backup-1",
      "description": "volume backup",
      "size": 2147483648,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
success boolean Whether the operation succeeded. 0.6
error ErrorCode Error code. If this field is not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.0.0
inventories List For details, see inventories 3.0.0
#error
Name Type Description Starting Version
code String Error code, which globally and uniquely identifies the error, for example, SYS.1000 or HOST.1001 0.6
description String Summary description of the error 0.6
details String Details of the error 0.6
elaboration String Reserved field. The default value is null 0.6
opaque LinkedHashMap Reserved field. The default value is null 0.6
cause ErrorCode Root error that caused the current error. This field is null if there is no source error 0.6
#inventories
Name Type Description Starting Version
uuid String The UUID of the disk backup. Uniquely identifies the resource 2.6
volumeUuid String Disk UUID 2.6
name String Backup name 2.6
description String Detailed description of the backup 2.6
type String Disk type 2.6
state String The enabled state of the disk backup 2.6
status String The status of the disk backup 2.6
size Long The size of the current disk backup 2.6
metadata String Metadata related to the disk backup 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6
encrypted Boolean Whether the backup data is encrypted 5.1
keyLastOpDate Timestamp Last update time of the encrypted-backup key. This field is empty for an unencrypted backup 5.1
backupStorageRefs List For details, see backupStorageRefs 2.6
#backupStorageRefs
Name Type Description Starting Version
volumeBackupUuid String The UUID of the disk backup 2.6
backupStorageUuid String Image Storage UUID 2.6
installPath String The data path of the disk backup 2.6
status String The status of the disk backup on the Image Storage 2.6
createDate Timestamp Creation time 2.6
lastOpDate Timestamp Last modification time 2.6

SDK Examples

Java SDK
SyncVmBackupFromImageStoreBackupStorageAction action = new SyncVmBackupFromImageStoreBackupStorageAction();
action.groupUuid = "14e53ad2aecd3e7ebe1f05cb4f5dd6a5";
action.srcBackupStorageUuid = "3428f7d03e493f89b32c57ef80a7e5af";
action.dstBackupStorageUuid = "6f8c528537a9347a86da7a96fb7418d4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncVmBackupFromImageStoreBackupStorageAction.Result res = action.call();
Python SDK
action = SyncVmBackupFromImageStoreBackupStorageAction()
action.groupUuid = "14e53ad2aecd3e7ebe1f05cb4f5dd6a5"
action.srcBackupStorageUuid = "3428f7d03e493f89b32c57ef80a7e5af"
action.dstBackupStorageUuid = "6f8c528537a9347a86da7a96fb7418d4"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateDatabaseBackup

API Request

URLs
POST zstack/v1/database-backups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "cloud-db",
    "backupStorageUuid": "676c5945223647698fcf4da2fa46d1dd"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"cloud-db","backupStorageUuid":"0c0f5fc523d8420a97a9be367f112b4a"}}' http://localhost:8080/zstack/v1/database-backups
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (Contained in the params structure) Resource name 3.0.0
description String body (Contained in the params structure) Detailed description of the resource 3.0.0
backupStorageUuid String body (Contained in the params structure) Image Storage UUID 3.0.0
resourceUuid (Optional) String body (Contained in the params structure) Optional. The resource UUID. 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "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 failed. This field is null on success. For details, see error 3.0.0
inventory DatabaseBackupInventory For details, see inventory 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 3.0.0
name String Resource name 3.0.0
description String Detailed description of the resource 3.0.0
state String The resource state. 3.0.0
status String The resource status. 3.0.0
size Long The size. 3.0.0
metadata String The metadata. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0
backupStorageRefs List For details, see backupStorageRefs 3.0.0
#backupStorageRefs
Name Type Description Starting Version
databaseBackupUuid String The database backup UUID. 3.0.0
backupStorageUuid String Image Storage UUID 3.0.0
installPath String The installation path. 3.0.0
exportUrl String The export URL. 3.0.0
status String The resource status. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0

SDK Examples

Java SDK
CreateDatabaseBackupAction action = new CreateDatabaseBackupAction();
action.name = "cloud-db";
action.backupStorageUuid = "35c0d1e417d84bf498be201091f39c49";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDatabaseBackupAction.Result res = action.call();
Python SDK
CreateDatabaseBackupAction action = CreateDatabaseBackupAction()
action.name = "cloud-db"
action.backupStorageUuid = "476870bf9c4241c8993340bd0703d0bf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDatabaseBackupAction.Result res = action.call()

DeleteDatabaseBackup

API Request

URLs
DELETE zstack/v1/database-backups/{uuid}?backupStorageUuids={backupStorageUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/database-backups/9caf0430ce473651ae7033e1a16a0097?backupStorageUuids=0c54ad64cd8d3ca1ba9d98864bb83571
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource 3.0.0
backupStorageUuids (Optional) List url Image Storage UUID list 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
DeleteDatabaseBackupAction action = new DeleteDatabaseBackupAction();
action.uuid = "9caf0430ce473651ae7033e1a16a0097";
action.backupStorageUuids = asList("0c54ad64cd8d3ca1ba9d98864bb83571");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteDatabaseBackupAction.Result res = action.call();
Python SDK
DeleteDatabaseBackupAction action = DeleteDatabaseBackupAction()
action.uuid = "9caf0430ce473651ae7033e1a16a0097"
action.backupStorageUuids = [0c54ad64cd8d3ca1ba9d98864bb83571]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteDatabaseBackupAction.Result res = action.call()

QueryDatabaseBackup

API Request

URLs
GET zstack/v1/database-backups
GET zstack/v1/database-backups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups?q=uuid=9f5010336a233d6ebbd82594a6d56e7c
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups/296a7da913333dd992d89bf30d9304ed

Queryable Fields

Run the CLI command line tool, enter QueryDatabaseBackup and press the Tab key to view all queryable fields and cross-table queryable resource names.

API Response

Response Example
{
  "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 failed. This field is null on success. For details, see error 3.0.0
inventories List For details, see inventories 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0
#inventories
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 3.0.0
name String Resource name 3.0.0
description String Detailed description of the resource 3.0.0
state String The resource state. 3.0.0
status String The resource status. 3.0.0
size Long The size. 3.0.0
metadata String The metadata. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0
backupStorageRefs List For details, see backupStorageRefs 3.0.0
#backupStorageRefs
Name Type Description Starting Version
databaseBackupUuid String The database backup UUID. 3.0.0
backupStorageUuid String Image Storage UUID 3.0.0
installPath String The installation path. 3.0.0
exportUrl String The export URL. 3.0.0
status String The resource status. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0

SDK Examples

Java SDK
QueryDatabaseBackupAction action = new QueryDatabaseBackupAction();
action.conditions = asList("uuid=74b420b3e877354e832a900915aab41a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryDatabaseBackupAction.Result res = action.call();
Python SDK
QueryDatabaseBackupAction action = QueryDatabaseBackupAction()
action.conditions = ["uuid=b11af605703231b4a898bed3fb7d94c0"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryDatabaseBackupAction.Result res = action.call()

SyncDatabaseBackup

API Request

URLs
PUT zstack/v1/database-backups/imageStore/{imageStoreUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncDatabaseBackup": {},
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncDatabaseBackup":{}}' http://localhost:8080/zstack/v1/database-backups/imageStore/77e7125f5ecf4cbe9129b0e8483a00ae/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
imageStoreUuid String url Backup storage UUID 3.2.0
systemTags (Optional) List body Optional. The system tags. 3.2.0
userTags (Optional) List body Optional. The user tags. 3.2.0

API Response

Response Example
{
  "result": {
    "deletedBackupCount": 1.0,
    "newBackupCount": 3.0
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation failed. This field is null on success. For details, see error 0.6
result SyncBackupResult For details, see result 3.8.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 0.6
description String A brief description of the error 0.6
details String The detailed error information 0.6
elaboration String Reserved field. Default is null 0.6
opaque LinkedHashMap Reserved field. Default is null 0.6
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 0.6
#result
Name Type Description Starting Version
deletedBackupCount int Number of deleted backups 3.7.0
newBackupCount int Number of new backups 3.7.0

SDK Examples

Java SDK
SyncDatabaseBackupAction action = new SyncDatabaseBackupAction();
action.imageStoreUuid = "e0803f92a12b42688d20f68beef19588";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncDatabaseBackupAction.Result res = action.call();
Python SDK
SyncDatabaseBackupAction action = SyncDatabaseBackupAction()
action.imageStoreUuid = "0de54b0b3067493f9461fc74906dfc54"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncDatabaseBackupAction.Result res = action.call()

RecoverDatabaseFromBackup

Recover database backup from backup storage.

API Request

URLs
PUT zstack/v1/database-backups/actions?uuid={uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "recoverDatabaseFromBackup": {
    "backupStorageUrl": "ssh://root:password@localhost:22/Cloud_bs",
    "backupInstallPath": "zstore://zsbak/0ed599ec519249489475112a058bb93a",
    "mysqlRootPassword": "password"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X 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
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid (Optional) String url The UUID of the resource. Uniquely identifies the resource 3.0.0
backupStorageUrl (Optional) String body (Contained in the recoverDatabaseFromBackup structure) Image Storage URL 3.0.0
backupInstallPath (Optional) String body (Contained in the recoverDatabaseFromBackup structure) Database backup storage path 3.0.0
mysqlRootPassword String body (Contained in the recoverDatabaseFromBackup structure) MySQL database ROOT password 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "logListenPort": 0.0
}
Name Type Description Starting Version
logListenPort int Browsers can use this port number to print logs in real time 3.0.0
error ErrorCode The error code. If not null, the operation failed. This field is null on success. For details, see error 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0

SDK Examples

Java SDK
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();
Python SDK
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

Export database backup from backup storage.

API Request

URLs
PUT zstack/v1/database-backups/{databaseBackupUuid}/backup-storage/{backupStorageUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "exportDatabaseBackupFromBackupStorage": {},
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"exportDatabaseBackupFromBackupStorage":{}}' http://localhost:8080/zstack/v1/database-backups/6dae84793fc53f5b82034dd9a44c554b/backup-storage/cc9127f6af0e32c888044f49048788a1/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
backupStorageUuid String url Image Storage UUID 3.0.0
databaseBackupUuid String url Database backup UUID 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "databaseBackupUrl": "http://127.0.0.1:8001/path/cloud-db-backup.gz"
}
Name Type Description Starting Version
databaseBackupUrl String Access URL of the exported backup 3.0.0
error ErrorCode The error code. If not null, the operation failed. This field is null on success. For details, see error 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0

SDK Examples

Java SDK
ExportDatabaseBackupFromBackupStorageAction action = new ExportDatabaseBackupFromBackupStorageAction();
action.backupStorageUuid = "cc9127f6af0e32c888044f49048788a1";
action.databaseBackupUuid = "6dae84793fc53f5b82034dd9a44c554b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExportDatabaseBackupFromBackupStorageAction.Result res = action.call();
Python SDK
ExportDatabaseBackupFromBackupStorageAction action = ExportDatabaseBackupFromBackupStorageAction()
action.backupStorageUuid = "cc9127f6af0e32c888044f49048788a1"
action.databaseBackupUuid = "6dae84793fc53f5b82034dd9a44c554b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ExportDatabaseBackupFromBackupStorageAction.Result res = action.call()

GetDatabaseBackupFromImageStore

Get exported database backup from backup storage.

API Request

URLs
GET zstack/v1/database-backups/image-store
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/database-backups/image-store?url=ssh://root:password@localhost:22/Cloud_bs&registryPort=8000.0
Parameter List
Name Type Location Description Allowed Values Starting Version
url String query Image Storage URL 3.0.0
registryPort (Optional) int query Image repository access port 3.0.0
systemTags (Optional) List query Optional. The system tags. 3.0.0
userTags (Optional) List query Optional. The user tags. 3.0.0

API Response

Response Example
{
  "infos": [
    {
      "id": "270c67e3699f72ba",
      "created": "Nov 14, 2017 10:20:57 PM",
      "author": "cloud",
      "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 failed. This field is null on success. For details, see error 3.0.0
infos List For details, see infos 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0
#infos
Name Type Description Starting Version
id String ID in the image repository 3.0.0
parent String Parent image name 3.0.0
blobsum String Image hash 3.0.0
created Timestamp Image commit time 3.0.0
author String Image author 3.0.0
arch String OS architecture of the image 3.0.0
desc String Image description 3.0.0
size Long Actual size of the image 3.0.0
virtualsize Long Virtual size of the image 3.0.0
name String Image name in the image repository 3.0.0

SDK Examples

Java SDK
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();
Python SDK
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

Delete the exported database backup.

API Request

URLs
DELETE zstack/v1/exported-database-backup/{databaseBackupUuid}/backup-storage/{backupStorageUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/exported-database-backup/341a599af82f3ecbab5d680e8dfb0276/backup-storage/737f27cb664c31a594f71080d481dddf?
Parameter List
Name Type Location Description Allowed Values Starting Version
backupStorageUuid String url Image Storage UUID 3.0.0
databaseBackupUuid String url The database backup UUID. 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
DeleteExportedDatabaseBackupFromBackupStorageAction action = new DeleteExportedDatabaseBackupFromBackupStorageAction();
action.backupStorageUuid = "737f27cb664c31a594f71080d481dddf";
action.databaseBackupUuid = "341a599af82f3ecbab5d680e8dfb0276";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteExportedDatabaseBackupFromBackupStorageAction.Result res = action.call();
Python SDK
DeleteExportedDatabaseBackupFromBackupStorageAction action = DeleteExportedDatabaseBackupFromBackupStorageAction()
action.backupStorageUuid = "737f27cb664c31a594f71080d481dddf"
action.databaseBackupUuid = "341a599af82f3ecbab5d680e8dfb0276"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteExportedDatabaseBackupFromBackupStorageAction.Result res = action.call()

SyncDatabaseBackupFromImageStoreBackupStorage

Sync backup to backup storage.

API Request

URLs
PUT zstack/v1/database-backups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncDatabaseBackupFromImageStoreBackupStorage": {
    "srcBackupStorageUuid": "72ad4c5419d63f5aaf37faf985c95a65",
    "dstBackupStorageUuid": "76b2c6b412a73ef8a4263e659c104fff"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncDatabaseBackupFromImageStoreBackupStorage":{"srcBackupStorageUuid":"72ad4c5419d63f5aaf37faf985c95a65","dstBackupStorageUuid":"76b2c6b412a73ef8a4263e659c104fff"}}' http://localhost:8080/zstack/v1/database-backups/4594a949f00e3a55932f5b5e66ec9d67/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource 3.0.0
srcBackupStorageUuid String body (Contained in the syncDatabaseBackupFromImageStoreBackupStorage structure) The src backup storage UUID. 3.0.0
dstBackupStorageUuid String body (Contained in the syncDatabaseBackupFromImageStoreBackupStorage structure) The dst backup storage UUID. 3.0.0
systemTags (Optional) List body Optional. The system tags. 3.0.0
userTags (Optional) List body Optional. The user tags. 3.0.0

API Response

Response Example
{
  "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 failed. This field is null on success. For details, seeerror 3.0.0
inventory DatabaseBackupInventory For details, seeinventory 3.0.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.0.0
description String A brief description of the error 3.0.0
details String The detailed error information 3.0.0
elaboration String Reserved field. Default is null 3.0.0
opaque LinkedHashMap Reserved field. Default is null 3.0.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.0.0
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource 3.0.0
name String Resource name 3.0.0
description String Detailed description of the resource 3.0.0
state String The resource state. 3.0.0
status String The resource status. 3.0.0
size Long The size. 3.0.0
metadata String The metadata. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0
backupStorageRefs List For details, seebackupStorageRefs 3.0.0
#backupStorageRefs
Name Type Description Starting Version
databaseBackupUuid String The database backup UUID. 3.0.0
backupStorageUuid String Image Storage UUID 3.0.0
installPath String The installation path. 3.0.0
exportUrl String The export URL. 3.0.0
status String The resource status. 3.0.0
createDate Timestamp Creation time 3.0.0
lastOpDate Timestamp Last modification time 3.0.0

SDK Examples

Java SDK
SyncDatabaseBackupFromImageStoreBackupStorageAction action = new SyncDatabaseBackupFromImageStoreBackupStorageAction();
action.uuid = "4594a949f00e3a55932f5b5e66ec9d67";
action.srcBackupStorageUuid = "72ad4c5419d63f5aaf37faf985c95a65";
action.dstBackupStorageUuid = "76b2c6b412a73ef8a4263e659c104fff";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncDatabaseBackupFromImageStoreBackupStorageAction.Result res = action.call();
Python SDK
SyncDatabaseBackupFromImageStoreBackupStorageAction action = SyncDatabaseBackupFromImageStoreBackupStorageAction()
action.uuid = "4594a949f00e3a55932f5b5e66ec9d67"
action.srcBackupStorageUuid = "72ad4c5419d63f5aaf37faf985c95a65"
action.dstBackupStorageUuid = "76b2c6b412a73ef8a4263e659c104fff"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncDatabaseBackupFromImageStoreBackupStorageAction.Result res = action.call()

AddSchedulerJobGroupToSchedulerTrigger

API Request

URLs
POST zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/scheduler/triggers/{schedulerTriggerUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "triggerNow": false
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"triggerNow":false}}' http://localhost:8080/zstack/v1/scheduler/jobgroups/997c126bb3db39f6bbda1ffe90008f51/scheduler/triggers/78341d4e8f683a3291527f4944fa6831
Parameter List
Name Type Location Description Allowed Values Starting Version
schedulerJobGroupUuid String url Scheduler job group UUID 3.4.0
schedulerTriggerUuid String url Trigger UUID 3.4.0
triggerNow (Optional) boolean body (Contained in the params structure) Whether to trigger immediately 3.4.0
systemTags (Optional) List body System tag list 3.4.0
userTags (Optional) List body User tag list 3.4.0

API Response

Response Example
{
  "inventory": {
    "schedulerJobGroupUuid": "ec8d2952f8f13747bbbf24f93585a63d",
    "schedulerTriggerUuid": "4b5bc56b58623324afe0a57951a96064"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation failed. This field is null on success. For details, seeerror 3.4.0
inventory SchedulerJobGroupSchedulerTriggerRefInventory For details, seeinventory 3.4.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001 3.4.0
description String A brief description of the error 3.4.0
details String The detailed error information 3.4.0
elaboration String Reserved field. Default is null 3.4.0
opaque LinkedHashMap Reserved field. Default is null 3.4.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error 3.4.0
#inventory
Name Type Description Starting Version
schedulerJobGroupUuid String Scheduler job group UUID 3.4.0
schedulerTriggerUuid String Trigger UUID 3.4.0
createDate Timestamp Creation time 3.4.0
lastOpDate Timestamp Last modification time 3.4.0

SDK Examples

Java SDK
AddSchedulerJobGroupToSchedulerTriggerAction action = new AddSchedulerJobGroupToSchedulerTriggerAction();
action.schedulerJobGroupUuid = "997c126bb3db39f6bbda1ffe90008f51";
action.schedulerTriggerUuid = "78341d4e8f683a3291527f4944fa6831";
action.triggerNow = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobGroupToSchedulerTriggerAction.Result res = action.call();
Python SDK
AddSchedulerJobGroupToSchedulerTriggerAction action = AddSchedulerJobGroupToSchedulerTriggerAction()
action.schedulerJobGroupUuid = "997c126bb3db39f6bbda1ffe90008f51"
action.schedulerTriggerUuid = "78341d4e8f683a3291527f4944fa6831"
action.triggerNow = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSchedulerJobGroupToSchedulerTriggerAction.Result res = action.call()

RemoveSchedulerJobGroupFromSchedulerTrigger

API Request

URLs
DELETE zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/scheduler/triggers/{schedulerTriggerUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/769b8cc2ba343736a919f4a849663fdb/scheduler/triggers/e0f1e497653b39639ff6eac7f6cd2e48?
Parameter List
Name Type Location Description Allowed Values Starting Version
schedulerJobGroupUuid String url Scheduler job group UUID 3.4.0
schedulerTriggerUuid String url Trigger UUID 3.4.0
systemTags (Optional) List body System tag list 3.4.0
userTags (Optional) List body User tag list 3.4.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
RemoveSchedulerJobGroupFromSchedulerTriggerAction action = new RemoveSchedulerJobGroupFromSchedulerTriggerAction();
action.schedulerJobGroupUuid = "769b8cc2ba343736a919f4a849663fdb";
action.schedulerTriggerUuid = "e0f1e497653b39639ff6eac7f6cd2e48";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSchedulerJobGroupFromSchedulerTriggerAction.Result res = action.call();
Python SDK
RemoveSchedulerJobGroupFromSchedulerTriggerAction action = RemoveSchedulerJobGroupFromSchedulerTriggerAction()
action.schedulerJobGroupUuid = "769b8cc2ba343736a919f4a849663fdb"
action.schedulerTriggerUuid = "e0f1e497653b39639ff6eac7f6cd2e48"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSchedulerJobGroupFromSchedulerTriggerAction.Result res = action.call()

RunSchedulerTrigger

API Request

URLs
PUT zstack/v1/scheduler/triggers/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "runSchedulerTrigger": {},
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"runSchedulerTrigger":{}}' http://localhost:8080/zstack/v1/scheduler/triggers/2a486c1cd0cd43f3ac40bd60c6dd6fc1/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url Scheduler trigger UUID 3.5.0
jobUuids (Optional) List body (Contained in the runSchedulerTrigger structure) Optional job UUIDs to trigger 3.5.0
systemTags (Optional) List body Optional. The system tags. 3.5.0
userTags (Optional) List body Optional. The user tags. 3.5.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
RunSchedulerTriggerAction action = new RunSchedulerTriggerAction();
action.uuid = "61b439ee76004c51bc262324d6eaa332";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RunSchedulerTriggerAction.Result res = action.call();
Python SDK
RunSchedulerTriggerAction action = RunSchedulerTriggerAction()
action.uuid = "8a5ed7d3e0194c2a98d1ecb529b15875"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RunSchedulerTriggerAction.Result res = action.call()

CreateSchedulerJobGroup

API Request

URLs
POST zstack/v1/scheduler/jobgroups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "job",
    "description": "description",
    "type": "startVm"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"job","description":"description","type":"startVm"}}' http://localhost:8080/zstack/v1/scheduler/jobgroups
Parameter List
Name Type Location Description Allowed Values Starting Version
name String body (included in the params structure) Resource name 3.4.0
description (optional) String body (included in the params structure) Detailed description of the resource 3.4.0
type String body (included in the params structure) Scheduler job type
  • startVm
  • stopVm
  • rebootVm
  • volumeSnapshot
  • volumeBackup
  • vmBackup
  • databaseBackup
  • runAutoScalingGroup
  • addIAM2ProjectLoginExpired
  • cancleIAM2ProjectLoginExpired
4.3.0
parameters (optional) Map body (included in the params structure) Scheduler job parameters 3.4.0
resourceUuid (optional) String body (included in the params structure) Resource UUID 3.4.0
tagUuids (optional) List body (included in the params structure) Tag UUID list 3.4.0
systemTags (optional) List body System tag list 3.4.0
userTags (optional) List body User tag list 3.4.0

API Response

Response Example
{
  "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 Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.4.0
inventory SchedulerJobInventory For details, see inventory 3.4.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.4.0
description String Brief description of the error 3.4.0
details String Detailed information about the error 3.4.0
elaboration String Reserved field. Default is null 3.4.0
opaque LinkedHashMap Reserved field. Default is null 3.4.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.4.0
#inventory
Name Type Description Starting Version
uuid String Resource UUID. Uniquely identifies the resource 3.4.0
targetResourceUuid String The target resource UUID. 3.4.0
name String Resource name 3.4.0
description String Detailed description of the resource 3.4.0
state String The resource state. 3.4.0
createDate Timestamp Creation time 3.4.0
lastOpDate Timestamp Last modification time 3.4.0
triggersUuid List The triggers UUID. 3.4.0

SDK Examples

Java SDK
CreateSchedulerJobGroupAction action = new CreateSchedulerJobGroupAction();
action.name = "job";
action.description = "description";
action.type = "startVm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateSchedulerJobGroupAction.Result res = action.call();
Python SDK
CreateSchedulerJobGroupAction action = CreateSchedulerJobGroupAction()
action.name = "job"
action.description = "description"
action.type = "startVm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateSchedulerJobGroupAction.Result res = action.call()

DeleteSchedulerJobGroup

API Request

URLs
DELETE zstack/v1/scheduler/jobgroups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/8bf8b175d6ce337eb24cbe37d9fe9b82
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url UUID of the scheduler job group. Uniquely identifies the resource 3.4.0
deleteMode (optional) String body Deletion mode 3.4.0
systemTags (optional) List body System tag list 3.4.0
userTags (optional) List body User tag list 3.4.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field, for example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
DeleteSchedulerJobGroupAction action = new DeleteSchedulerJobGroupAction();
action.uuid = "8bf8b175d6ce337eb24cbe37d9fe9b82";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteSchedulerJobGroupAction.Result res = action.call();
Python SDK
DeleteSchedulerJobGroupAction action = DeleteSchedulerJobGroupAction()
action.uuid = "8bf8b175d6ce337eb24cbe37d9fe9b82"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteSchedulerJobGroupAction.Result res = action.call()

UpdateSchedulerJobGroup

API Request

URLs
PUT zstack/v1/scheduler/jobgroups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateSchedulerJobGroup": {
    "name": "Test2",
    "description": "new test"
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateSchedulerJobGroup":{"name":"Test2","description":"new test"}}' http://localhost:8080/zstack/v1/scheduler/jobgroups/4dc1dbf847d733fc98ee2998b5e0eca2/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url UUID of the scheduler job group. Uniquely identifies the resource 3.4.0
name (optional) String body (included in the updateSchedulerJobGroup structure) Resource name 3.4.0
description (optional) String body (included in the updateSchedulerJobGroup structure) Detailed description of the resource 3.4.0
state (optional) String body (included in the updateSchedulerJobGroup structure) State
  • enable
  • disable
3.4.0
parameters (optional) Map body (included in the updateSchedulerJobGroup structure) Scheduler job group parameters 3.4.0
systemTags (optional) List body System tag list 3.4.0
userTags (optional) List body User tag list 3.4.0

API Response

Response Example
{
  "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 Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.4.0
inventory SchedulerJobGroupInventory For details, see inventory 3.4.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.4.0
description String Brief description of the error 3.4.0
details String Detailed information about the error 3.4.0
elaboration String Reserved field. Default is null 3.4.0
opaque LinkedHashMap Reserved field. Default is null 3.4.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.4.0
#inventory
Name Type Description Starting Version
uuid String UUID of the scheduler job group. Uniquely identifies the resource 3.4.0
name String Scheduler job group name 3.4.0
description String Detailed description of the scheduler job group 3.4.0
state String State of the scheduler job group 3.4.0
createDate Timestamp Creation time 3.4.0
lastOpDate Timestamp Last modification time 3.4.0
jobData String Job parameters 3.4.0
triggersUuid List Trigger UUID 3.4.0

SDK Examples

Java SDK
UpdateSchedulerJobGroupAction action = new UpdateSchedulerJobGroupAction();
action.uuid = "4dc1dbf847d733fc98ee2998b5e0eca2";
action.name = "Test2";
action.description = "new test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSchedulerJobGroupAction.Result res = action.call();
Python SDK
UpdateSchedulerJobGroupAction action = UpdateSchedulerJobGroupAction()
action.uuid = "4dc1dbf847d733fc98ee2998b5e0eca2"
action.name = "Test2"
action.description = "new test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSchedulerJobGroupAction.Result res = action.call()

QuerySchedulerJobGroup

API Request

URLs
GET zstack/v1/scheduler/jobgroups
GET zstack/v1/scheduler/jobgroups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobgroups?q=name=TestJobGroup&q=state=Enabled
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/jobgroups/c5cb16296a1334d2ac3cd666e1deeca3

Queryable Fields

Run the CLI command line tool, enter QuerySchedulerJobGroup, and press Tab to view all queryable fields and the resource names that support cross-table queries.

API Response

Response Example
{
  "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 Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.4.0
inventories List For details, see inventories 3.4.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.4.0
description String Brief description of the error 3.4.0
details String Detailed information about the error 3.4.0
elaboration String Reserved field. Default is null 3.4.0
opaque LinkedHashMap Reserved field. Default is null 3.4.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.4.0
#inventories
Name Type Description Starting Version
uuid String UUID of the scheduler job group. Uniquely identifies the resource 3.4.0
name String Scheduler job group name 3.4.0
description String Detailed description of the scheduler job group 3.4.0
state String State of the scheduler job group 3.4.0
createDate Timestamp Creation time 3.4.0
lastOpDate Timestamp Last modification time 3.4.0
jobData String Job parameters 3.4.0
triggersUuid List Trigger UUID 3.4.0

SDK Examples

Java SDK
QuerySchedulerJobGroupAction action = new QuerySchedulerJobGroupAction();
action.conditions = asList("name=TestJobGroup","state=Enabled");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QuerySchedulerJobGroupAction.Result res = action.call();
Python SDK
QuerySchedulerJobGroupAction action = QuerySchedulerJobGroupAction()
action.conditions = ["name=TestJobGroup","state=Enabled"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QuerySchedulerJobGroupAction.Result res = action.call()

AddSchedulerJobsToSchedulerJobGroup

API Request

URLs
POST zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/job
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "schedulerJobUuids": [
      "ed43fba83eb63a1cacb38c113e2bd38a"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"schedulerJobUuids":["ed43fba83eb63a1cacb38c113e2bd38a"]}}' \
http://localhost:8080/zstack/v1/scheduler/jobgroups/280d3a22ab363006b61b4a6c0318056f/job
Parameter List
Name Type Location Description Allowed Values Starting Version
schedulerJobGroupUuid String url Scheduler job group UUID 3.4.0
schedulerJobUuids List body (included in the params structure) Scheduler job UUID list 3.4.0
priorities (optional) Map body (included in the params structure) Scheduler job priority 4.3.0
systemTags (optional) List body System tags 3.4.0
userTags (optional) List body User tags 3.4.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field, for example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
AddSchedulerJobsToSchedulerJobGroupAction action = new AddSchedulerJobsToSchedulerJobGroupAction();
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f";
action.schedulerJobUuids = asList("ed43fba83eb63a1cacb38c113e2bd38a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call();
Python SDK
AddSchedulerJobsToSchedulerJobGroupAction action = AddSchedulerJobsToSchedulerJobGroupAction()
action.schedulerJobGroupUuid = "280d3a22ab363006b61b4a6c0318056f"
action.schedulerJobUuids = [ed43fba83eb63a1cacb38c113e2bd38a]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSchedulerJobsToSchedulerJobGroupAction.Result res = action.call()

RemoveSchedulerJobsFromSchedulerJobGroup

API Request

URLs
DELETE zstack/v1/scheduler/jobgroups/{schedulerJobGroupUuid}/job/{schedulerJobUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/scheduler/jobgroups/fa287a3654d330658db1863b8a41a660/job/[24634a04cc45397cb0298258a47ad650]
Parameter List
Name Type Location Description Allowed Values Starting Version
schedulerJobGroupUuid String url Scheduler job group UUID 3.4.0
schedulerJobUuids List url Scheduler job UUID list 3.4.0
systemTags (optional) List body System tag list 3.4.0
userTags (optional) List body User tag list 3.4.0

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field, for example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
RemoveSchedulerJobsFromSchedulerJobGroupAction action = new RemoveSchedulerJobsFromSchedulerJobGroupAction();
action.schedulerJobGroupUuid = "fa287a3654d330658db1863b8a41a660";
action.schedulerJobUuids = asList("24634a04cc45397cb0298258a47ad650");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveSchedulerJobsFromSchedulerJobGroupAction.Result res = action.call();
Python SDK
RemoveSchedulerJobsFromSchedulerJobGroupAction action = RemoveSchedulerJobsFromSchedulerJobGroupAction()
action.schedulerJobGroupUuid = "fa287a3654d330658db1863b8a41a660"
action.schedulerJobUuids = [24634a04cc45397cb0298258a47ad650]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveSchedulerJobsFromSchedulerJobGroupAction.Result res = action.call()

QuerySchedulerJobHistory

API Request

URLs
GET zstack/v1/scheduler/job/history
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/job/history?q=schedulerJobGroupUuid=7ae6456c0b01324dae6d4bef358a5772

Queryable Fields

Run the CLI command line tool, enter QuerySchedulerJobHistory, and press Tab to view all queryable fields and the resource names that support cross-table queries.

API Response

Response Example
{
  "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 Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.5.0
inventories List For details, see inventories 3.5.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.5.0
description String Brief description of the error 3.5.0
details String Detailed information about the error 3.5.0
elaboration String Reserved field. Default is null 3.5.0
opaque LinkedHashMap Reserved field. Default is null 3.5.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.5.0
#inventories
Name Type Description Starting Version
id long The resource ID. 3.5.0
triggerUuid String Trigger UUID 3.5.0
schedulerJobUuid String Scheduler job UUID 3.5.0
schedulerJobGroupUuid String Scheduler job group UUID 3.5.0
startTime Timestamp Start time 3.5.0
executeTime long Execution duration 3.5.0
targetResourceUuid String Target resource UUID 3.5.0
requestDump String Job request 3.5.0
resultDump String Job result 3.5.0
success boolean Whether the operation succeeded. 3.5.0

SDK Examples

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

GetSchedulerExecutionReport

API Request

URLs
GET zstack/v1/scheduler/report
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/scheduler/report?startTime=1.5856704E12&intervalTimeUnit=Month&range=4.0&schedulerJobTypes=vmBackup
Parameter List
Name Type Location Description Allowed Values Starting Version
startTime long query Report start time 3.9.0
intervalTimeUnit String query Interval time unit
  • Hour
  • Month
3.9.0
range int query Report time range 3.9.0
schedulerJobTypes List query Scheduler job types 3.9.0
systemTags (optional) List query Optional. The system tags. 3.9.0
userTags (optional) List query Optional. The user tags. 3.9.0

API Response

Response Example
{
  "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 Success records 3.9.0
failureRecords List Failure records 3.9.0
partialSuccessRecords List Partial success records 3.9.0
waitingRecords List Waiting for execution records 3.9.0
success boolean Whether the operation succeeded. 3.9.0
error ErrorCode Error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.9.0
error ErrorCode For details, see error 3.9.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.9.0
description String Brief description of the error 3.9.0
details String Detailed information about the error 3.9.0
elaboration String Reserved field. Default is null 3.9.0
opaque LinkedHashMap Reserved field. Default is null 3.9.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.9.0
#error
Name Type Description Starting Version
code String Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001 3.9.0
description String Brief description of the error 3.9.0
details String Detailed information about the error 3.9.0
elaboration String Reserved field. Default is null 3.9.0
opaque LinkedHashMap Reserved field. Default is null 3.9.0
cause ErrorCode Root error. The source error that caused the current error. This field is null if there is no source error 3.9.0

SDK Examples

Java SDK
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();
Python SDK
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()

AddDisasterImageStoreBackupStorage

API Request

URLs
POST zstack/v1/backup-storage/image-store/disaster
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "attachPoint": "/test-bs",
    "endPoint": "test12345-snp99.cn-shanghai.nas.aliyuncs.com",
    "hostname": "192.168.1.8",
    "username": "admin",
    "password": "admin%pass",
    "sshPort": 22,
    "url": "/data/imagestore",
    "name": "ImageStore",
    "importImages": false
  },
  "systemTags": [],
  "userTags": []
}
Note: The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"attachPoint":"/test-bs","endPoint":"test12345-snp99.cn-shanghai.nas.aliyuncs.com","hostname":"192.168.1.8","username":"admin","password":"admin%pass","sshPort":22,"url":"/data/imagestore","name":"ImageStore","importImages":false}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/disaster
Parameter List
Name Type Location Description Allowed Values Starting Version
attachPoint (optional) String body (included in the params structure) Optional. The attach point. 0.6
endPoint (optional) String body (included in the params structure) Optional. The end point. 0.6
hostname String body (included in the params structure) The hostname. 0.6
username String body (included in the params structure) The username. 0.6
password (optional) String body (included in the params structure) Optional. The password. 0.6
sshPort (optional) int body (included in the params structure) Optional. The SSH port. 0.6
url String body (included in the params structure) The URL. 0.6
name String body (included in the params structure) Resource name 0.6
description (optional) String body (included in the params structure) Detailed description of the resource 0.6
type (optional) String body (included in the params structure) Optional. The resource type. 0.6
importImages (optional) boolean body (included in the params structure) Optional. The import images. 0.6
resourceUuid (optional) String body (included in the params structure) Resource UUID 0.6
tagUuids (optional) List body (included in the params structure) Tag UUID list 3.4.0
systemTags (optional) List body System tags 0.6
userTags (optional) List body User tags 0.6

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field, for example:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Examples

Java SDK
AddDisasterImageStoreBackupStorageAction action = new AddDisasterImageStoreBackupStorageAction();
action.attachPoint = "/test-bs";
action.endPoint = "test12345-snp99.cn-shanghai.nas.aliyuncs.com";
action.hostname = "192.168.1.8";
action.username = "admin";
action.password = "admin%pass";
action.sshPort = 22;
action.url = "/data/imagestore";
action.name = "ImageStore";
action.importImages = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddDisasterImageStoreBackupStorageAction.Result res = action.call();
Python SDK
AddDisasterImageStoreBackupStorageAction action = AddDisasterImageStoreBackupStorageAction()
action.attachPoint = "/test-bs"
action.endPoint = "test12345-snp99.cn-shanghai.nas.aliyuncs.com"
action.hostname = "192.168.1.8"
action.username = "admin"
action.password = "admin%pass"
action.sshPort = 22
action.url = "/data/imagestore"
action.name = "ImageStore"
action.importImages = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddDisasterImageStoreBackupStorageAction.Result res = action.call()
API Reference | ZStack ZSphere · ZVF | ZStack Resource Center