Document navigation

CBT Operations

CreateCbtTask

API Request

URLs
POST zstack/v1/cbt-task/create
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "My CDP Task",
    "vmInstanceUuid": "89878e17496030ba9c062cbb18924335"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"My CDP Task","vmInstanceUuid":"89878e17496030ba9c062cbb18924335"}}' http://localhost:8080/zstack/v1/cbt-task/create
Request Parameters
Name Type Location Description Valid Values Starting Version
name String body (contained in the params structure) The resource name. 5.3.28
description String body (contained in the params structure) Optional. The resource description. 5.3.28
resourceUuids List body (contained in the params structure) The resource UUID list. 5.3.28
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 5.3.28
tagUuids List body (contained in the params structure) Optional. The tag UUID list. 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags List body Optional. The system tags. 5.3.28

API Response

Sample Response
{
  "inventory": {
    "uuid": "b70f4160919c38748f908f489ba306ce",
    "name": "My Task",
    "status": "Created"
  }
}
Name Type Description Start Version
success boolean 5.3.28
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 5.3.28
inventory CbtTaskInventory See inventory 5.3.28
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.3.28
description String The brief description of the error. 5.3.28
details String The details about the error. 5.3.28
elaboration String The reserved field. Default value: null. 5.3.28
opaque LinkedHashMap The reserved field. Default value: null. 5.3.28
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 5.3.28
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 5.3.28
name String The resource name. 5.3.28
description String The resource description. 5.3.28
createDate Timestamp The creation time. 5.3.28
lastOpDate Timestamp The last operation time. 5.3.28
status CbtTaskStatus See status 5.3.28
#status
Name Type Description Satrting Version
Created CbtTaskStatus The task is created. 5.3.28
Starting CbtTaskStatus The task is starting. 5.3.28
Running CbtTaskStatus The task is running. 5.3.28
Stopped CbtTaskStatus The task is stopped. 5.3.28
Failed CbtTaskStatus The task failed. 5.3.28

SDK Sample

Java SDK
CreateCbtTaskAction action = new CreateCbtTaskAction();
action.name = "My CDP Task";
action.vmInstanceUuid = "89878e17496030ba9c062cbb18924335";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateCbtTaskAction.Result res = action.call();
Python SDK
CreateCbtTaskAction action = CreateCbtTaskAction()
action.name = "My CDP Task"
action.vmInstanceUuid = "89878e17496030ba9c062cbb18924335"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateCbtTaskAction.Result res = action.call()

DeleteCbtTask

API Request

URLs
DELETE zstack/v1/cbt-task/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/cbt-task/7017b8d5bef63877a528a5f56517c829
Request Parameters
Name Type Location Description Valid Values Starting Version
uuid String url The resource UUID. 5.3.28
force boolean body Optional. 5.3.28
deleteMode String body Optional. The deletion mode (Permissive / Enforcing,Permissive). 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags (可选) List body Optional. The user tags. 5.3.28

API返回

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteCbtTaskAction action = new DeleteCbtTaskAction();
action.uuid = "7017b8d5bef63877a528a5f56517c829";
action.force = false;
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCbtTaskAction.Result res = action.call();
Python SDK
DeleteCbtTaskAction action = DeleteCbtTaskAction()
action.uuid = "7017b8d5bef63877a528a5f56517c829"
action.force = false
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCbtTaskAction.Result res = action.call()

QueryCbtTask

API Request

URLs
GET zstack/v1/cbt-task
GET zstack/v1/cbt-task/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cbt-task?q=uuid=d6c3daab1c9b3274b5fc4088bd3e51ad
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cbt-task/cf426711ed6538069d2d4d6d34d5e60a

Queryable Fields

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

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "103f6f8dc6dc3f8b82c1e1923dc751e0",
      "name": "My Task",
      "status": "Running"
    }
  ]
}
Name Type Description Starting Version
success boolean 5.3.28
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 5.3.28
inventories List See inventories 5.3.28
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.3.28
description String The brief description of the error. 5.3.28
details String The details about the error. 5.3.28
elaboration String The reserved field. Default value: null. 5.3.28
opaque LinkedHashMap The reserved field. Default value: null. 5.3.28
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 5.3.28
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 5.3.28
name String The resource name. 5.3.28
description String The resource description. 5.3.28
createDate Timestamp The creation time. 5.3.28
lastOpDate Timestamp The last operation time. 5.3.28
status CbtTaskStatus See status 5.3.28
#status
Name Type Description Starting Version
Created CbtTaskStatus The task is created. 5.3.28
Starting CbtTaskStatus The task is starting. 5.3.28
Running CbtTaskStatus The task is running. 5.3.28
Stopped CbtTaskStatus The task is stopped. 5.3.28
Failed CbtTaskStatus The task failed. 5.3.28

SDK Sample

Java SDK
QueryCbtTaskAction action = new QueryCbtTaskAction();
action.conditions = asList("uuid=bd8fa811d9c234ceada09446fa085967");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCbtTaskAction.Result res = action.call();
Python SDK
QueryCbtTaskAction action = QueryCbtTaskAction()
action.conditions = ["uuid=0449908917ce338bba71c107848b7c5c"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCbtTaskAction.Result res = action.call()

EnableCbtTask

API Request

URLs
POST zstack/v1/cbt-task/enable/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "bitmapName": ""
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"bitmapName":""}}' http://localhost:8080/zstack/v1/cbt-task/enable/adced083701e39869540ee2af82da0da
Request Parameters
Name Type Location Description Valid Values Starting Version
uuid String url The resource UUID. 5.3.28
bitmapName String body (contained in the params structure). Optional 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags List body Optional. The user tags. 5.3.28

API Response

Sample Response
{
  "volumeCbtBackupInfos": [
    {}
  ]
}
Name Type Description Starting Version
success boolean 5.3.28
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 5.3.28
inventory CbtTaskInventory See inventory 5.3.28
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.3.28
description String The brief description of the error. 5.3.28
details String The details about the error. 5.3.28
elaboration String The reserved field. Default value: null. 5.3.28
opaque LinkedHashMap The reserved field. Default value: null. 5.3.28
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 5.3.28
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 5.3.28
name String The resource name. 5.3.28
description String The resource description. 5.3.28
createDate Timestamp The creation time. 5.3.28
lastOpDate Timestamp The last operation time. 5.3.28
status CbtTaskStatus See status 5.3.28
#status
Name Type Description Starting Version
Created CbtTaskStatus The task is created. 5.3.28
Starting CbtTaskStatus The task is starting. 5.3.28
Running CbtTaskStatus The task is running. 5.3.28
Stopped CbtTaskStatus The task is stopped. 5.3.28
Failed CbtTaskStatus The task failed. 5.3.28

SDK Sample

Java SDK
EnableCbtTaskAction action = new EnableCbtTaskAction();
action.uuid = "adced083701e39869540ee2af82da0da";
action.bitmapName = "";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
EnableCbtTaskAction.Result res = action.call();
Python SDK
EnableCbtTaskAction action = EnableCbtTaskAction()
action.uuid = "adced083701e39869540ee2af82da0da"
action.bitmapName = ""
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
EnableCbtTaskAction.Result res = action.call()

DisableCbtTask

API Request

URLs
POST zstack/v1/cbt-task/disable/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "force": false
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"force":false}}' http://localhost:8080/zstack/v1/cbt-task/disable/5a86262807b4363e95f2e57d2970d189
Request Parameters
Name Type Location Description Valid Values Starting Version
uuid String url The resource UUID. 5.3.28
force boolean body (contained in the params structure). Optional. Forcible or not. 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags List body Optional. The user tags. 5.3.28

API Response

Sample Response
{
  "inventory": {
    "uuid": "5ca9c15a50c53f0dac359a64841d7b2b",
    "name": "My Task",
    "status": "Stopped"
  }
}
Name Type Description Starting Version
success boolean 5.3.28
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 5.3.28
inventory CbtTaskInventory See inventory 5.3.28
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 5.3.28
description String The brief description of the error. 5.3.28
details String The details about the error. 5.3.28
elaboration String The reserved field. Default value: null. 5.3.28
opaque LinkedHashMap The reserved field. Default value: null. 5.3.28
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 5.3.28
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 5.3.28
name String The resource name. 5.3.28
description String The resource description. 5.3.28
createDate Timestamp The creation time. 5.3.28
lastOpDate Timestamp The last operation time. 5.3.28
status CbtTaskStatus See status 5.3.28
#status
Name Type Description Starting Version
Created CbtTaskStatus The task is created. 5.3.28
Starting CbtTaskStatus The task is starting. 5.3.28
Running CbtTaskStatus The task is running. 5.3.28
Stopped CbtTaskStatus The task is stopped. 5.3.28
Failed CbtTaskStatus The task failed. 5.3.28

SDK Sample

Java SDK
DisableCbtTaskAction action = new DisableCbtTaskAction();
action.uuid = "5a86262807b4363e95f2e57d2970d189";
action.force = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DisableCbtTaskAction.Result res = action.call();
Python SDK
DisableCbtTaskAction action = DisableCbtTaskAction()
action.uuid = "5a86262807b4363e95f2e57d2970d189"
action.force = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DisableCbtTaskAction.Result res = action.call()

ExportNbdVolumes

API Request

URLs
POST zstack/v1/cbt-task/exportvolume
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "volumeUuids": [
      "8d7de4e1c3b73fc49772b0fef78b0fc7"
    ],
    "vmInstanceUuid": "7d8c1dec326c3230be08d3c82fb7a476",
    "force": false
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"volumeUuids":["8d7de4e1c3b73fc49772b0fef78b0fc7"],"vmInstanceUuid":"7d8c1dec326c3230be08d3c82fb7a476","force":false}}' http://localhost:8080/zstack/v1/cbt-task/exportvolume
Request Parameters
Name Type Location Description Valid Values Starting Version
volumeUuids List body (contained in the params structure). The volume UUID list. 5.3.28
vmInstanceUuid String body (contained in the params structure). The VM UUID list. 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags List body Optional. The user tags. 5.3.28
force boolean body (contained in the params structure). Optional. Forcible or not. 5.3.28

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
ExportNbdVolumesAction action = new ExportNbdVolumesAction();
action.volumeUuids = asList("8d7de4e1c3b73fc49772b0fef78b0fc7");
action.vmInstanceUuid = "7d8c1dec326c3230be08d3c82fb7a476";
action.force = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExportNbdVolumesAction.Result res = action.call();
Python SDK
ExportNbdVolumesAction action = ExportNbdVolumesAction()
action.volumeUuids = [8d7de4e1c3b73fc49772b0fef78b0fc7]
action.vmInstanceUuid = "7d8c1dec326c3230be08d3c82fb7a476"
action.force = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ExportNbdVolumesAction.Result res = action.call()

UnexportNbdVolumes

API Request

URLs
POST zstack/v1/cbt-task/unexportvolume
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "volumeUuids": [
      "82eaf8972ece3e228b6f75f61f8749d9"
    ],
    "vmInstanceUuid": "6456713db34a3d7e96c7e132179c413d"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"volumeUuids":["82eaf8972ece3e228b6f75f61f8749d9"],"vmInstanceUuid":"6456713db34a3d7e96c7e132179c413d"}}' http://localhost:8080/zstack/v1/cbt-task/unexportvolume
Request Parameters
Name Type Location Description Valid Values Starting Version
volumeUuids List body (contained in the params structure). The volume UUID list. 5.3.28
vmInstanceUuid String body (contained in the params structure). The VM UUID list. 5.3.28
systemTags List body Optional. The system tags. 5.3.28
userTags List body Optional. The user tags. 5.3.28

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
UnexportNbdVolumesAction action = new UnexportNbdVolumesAction();
action.volumeUuids = asList("82eaf8972ece3e228b6f75f61f8749d9");
action.vmInstanceUuid = "6456713db34a3d7e96c7e132179c413d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UnexportNbdVolumesAction.Result res = action.call();
Python SDK
UnexportNbdVolumesAction action = UnexportNbdVolumesAction()
action.volumeUuids = [82eaf8972ece3e228b6f75f61f8749d9]
action.vmInstanceUuid = "6456713db34a3d7e96c7e132179c413d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UnexportNbdVolumesAction.Result res = action.call()
API Reference | 5.4.12 | ZStack Cloud · ZCF | ZStack Resource Center