持续数据保护(CDP)
持续数据保护(CDP)服务以单独的功能模块形式提供,需提前购买持续数据保护(CDP)模块许可证,且需在购买云平台许可证基础上使用,不可单独使用。
持续数据保护(CDP)相关接口
创建CDP策略(CreateCdpPolicy)
API请求
URLs
POST zstack/v1/cdp-backup-storage/policyHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "MyCdpPolicyName",
"description": "MyCdpDescription",
"hourlyRpSinceDay": 3.0,
"dailyRpSinceDay": 7.0,
"expireTimeInDay": 30.0,
"fullBackupIntervalInDay": 2.0,
"recoveryPointPerSecond": 5.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"MyCdpPolicyName","description":"MyCdpDescription","hourlyRpSinceDay":3.0,"dailyRpSinceDay":7.0,"expireTimeInDay":30.0,"fullBackupIntervalInDay":2.0,"recoveryPointPerSecond":5.0}}' http://localhost:8080/zstack/v1/cdp-backup-storage/policy参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 4.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.5.0 | |
| retentionTimePerDay | Integer | body(包含在params结构中) | 恢复点保留时间 | 4.5.0 | |
| recoveryPointPerSecond | Integer | body(包含在params结构中) | 恢复点间隔时间 | 4.5.0 | |
| hourlyRpSinceDay | Integer | body(包含在params结构中) | 从哪天开始保留每小时一个恢复点 | 4.5.0 | |
| dailyRpSinceDay | Integer | body(包含在params结构中) | 从哪天开始保留每天一个恢复点 | 4.5.0 | |
| expireTimeInDay | Integer | body(包含在params结构中) | 备份数据有效时间 | 4.5.0 | |
| fullBackupIntervalInDay | Integer | body(包含在params结构中) | 全量备份时间间隔 | 4.5.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.5.0 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"name": "MyCdpPolicyName",
"description": "MyCdpDescription",
"retentionTimePerDay": 7.0,
"recoveryPointPerSecond": 5.0
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpPolicyInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| retentionTimePerDay | Integer | 恢复点保留时间 | 4.5.0 |
| recoveryPointPerSecond | Integer | 恢复点间隔时间 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| state | CdpPolicyState | 详情参考state | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpPolicyState | 启用 | 4.5.0 |
| Disabled | CdpPolicyState | 停用 | 4.5.0 |
SDK示例
Java
SDK
CreateCdpPolicyAction action = new CreateCdpPolicyAction();
action.name = "MyCdpPolicyName";
action.description = "MyCdpDescription";
action.hourlyRpSinceDay = 3.0;
action.dailyRpSinceDay = 7.0;
action.expireTimeInDay = 30.0;
action.fullBackupIntervalInDay = 2.0;
action.recoveryPointPerSecond = 5.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateCdpPolicyAction.Result res = action.call();Python
SDK
CreateCdpPolicyAction action = CreateCdpPolicyAction()
action.name = "MyCdpPolicyName"
action.description = "MyCdpDescription"
action.hourlyRpSinceDay = 3.0
action.dailyRpSinceDay = 7.0
action.expireTimeInDay = 30.0
action.fullBackupIntervalInDay = 2.0
action.recoveryPointPerSecond = 5.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateCdpPolicyAction.Result res = action.call()删除CDP策略(DeleteCdpPolicy)
API请求
URLs
DELETE zstack/v1/cdp-backup-storage/policy/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/cdp-backup-storage/policy/6429f8a631993740b1c96e24bb64eca6参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| deleteMode (可选) | String | body | 删除模式 |
|
4.5.0 |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
DeleteCdpPolicyAction action = new DeleteCdpPolicyAction();
action.uuid = "6429f8a631993740b1c96e24bb64eca6";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCdpPolicyAction.Result res = action.call();Python
SDK
DeleteCdpPolicyAction action = DeleteCdpPolicyAction()
action.uuid = "6429f8a631993740b1c96e24bb64eca6"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCdpPolicyAction.Result res = action.call()查询CDP策略(QueryCdpPolicy)
API请求
URLs
GET zstack/v1/cdp-backup-storage/policy
GET zstack/v1/cdp-backup-storage/policy/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cdp-backup-storage/policy?q=uuid=c58c597901553c81bc469ebdc0324340curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cdp-backup-storage/policy/3cb711db1fbc3d80954ff45590fe11fc可查询字段
运行CLI命令行工具,输入QueryCdpPolicy并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"name": "MyCdpPolicyName",
"description": "MyCdpDescription",
"retentionTimePerDay": 7.0,
"recoveryPointPerSecond": 5.0
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。详情参考error | 4.5.0 |
| inventories | List | 详情参考inventories | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | CDP策略的UUID,唯一标示该CDP策略 | 4.5.0 |
| name | String | CDP策略名称 | 4.5.0 |
| description | String | CDP策略的详细描述 | 4.5.0 |
| retentionTimePerDay | Integer | 恢复点保留时间 | 4.5.0 |
| recoveryPointPerSecond | Integer | 恢复点间隔时间 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| state | CdpPolicyState | 详情参考state | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpPolicyState | 启用 | 4.5.0 |
| Disabled | CdpPolicyState | 停用 | 4.5.0 |
SDK示例
Java
SDK
QueryCdpPolicyAction action = new QueryCdpPolicyAction();
action.conditions = asList("uuid=1cd7a1588ee73b4bb4ced0524e397b5e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCdpPolicyAction.Result res = action.call();Python
SDK
QueryCdpPolicyAction action = QueryCdpPolicyAction()
action.conditions = ["uuid=e7b6b0ad3c903889b3de90408450120a"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCdpPolicyAction.Result res = action.call()更新CDP策略(UpdateCdpPolicy)
API请求
URLs
PUT zstack/v1/cdp-backup-storage/policy/{uuid}/actions Headers
Authorization: OAuth the-session-uuidBody
{
"updateCdpPolicy": {
"name": "MyCdpPolicyName",
"description": "MyCdpDescription",
"retentionTimePerDay": 7.0,
"hourlyRpSinceDay": 3.0,
"dailyRpSinceDay": 7.0,
"expireTimeInDay": 30.0,
"fullBackupIntervalInDay": 2.0,
"recoveryPointPerSecond": 5.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateCdpPolicy":{"name":"MyCdpPolicyName","description":"MyCdpDescription","retentionTimePerDay":7.0,"recoveryPointPerSecond":5.0}}' http://localhost:8080/zstack/v1/cdp-backup-storage/policy/e8e4ea26310e31fc9ee73329ebd5f180/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| name (可选) | String | body(包含在params结构中) | 资源名称 | 4.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.5.0 | |
| retentionTimePerDay (可选) | Integer | body(包含在params结构中) | 恢复点保留时间 | 4.5.0 | |
| recoveryPointPerSecond (可选) | Integer | body(包含在params结构中) | 恢复点间隔时间 | 4.5.0 | |
| hourlyRpSinceDay | Integer | body(包含在params结构中) | 从哪天开始保留每小时一个恢复点 | 4.5.0 | |
| dailyRpSinceDay | Integer | body(包含在params结构中) | 从哪天开始保留每天一个恢复点 | 4.5.0 | |
| expireTimeInDay | Integer | body(包含在params结构中) | 备份数据有效时间 | 4.5.0 | |
| fullBackupIntervalInDay | Integer | body(包含在params结构中) | 全量备份时间间隔 | 4.5.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.5.0 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"name": "MyCdpPolicyName",
"description": "MyCdpDescription",
"retentionTimePerDay": 7.0,
"recoveryPointPerSecond": 5.0
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpPolicyInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| retentionTimePerDay | Integer | 恢复点保留时间 | 4.5.0 |
| recoveryPointPerSecond | Integer | 恢复点间隔时间 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| backupStorageRefs | List | 详情参考state | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpPolicyState | 启用 | 4.5.0 |
| Disabled | CdpPolicyState | 停用 | 4.5.0 |
SDK示例
Java
SDK
UpdateCdpPolicyAction action = new UpdateCdpPolicyAction();
action.uuid = "e8e4ea26310e31fc9ee73329ebd5f180";
action.name = "MyCdpPolicyName";
action.description = "MyCdpDescription";
action.retentionTimePerDay = 7.0;
action.recoveryPointPerSecond = 5.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCdpPolicyAction.Result res = action.call();Python
SDK
UpdateCdpPolicyAction action = UpdateCdpPolicyAction()
action.uuid = "e8e4ea26310e31fc9ee73329ebd5f180"
action.name = "MyCdpPolicyName"
action.description = "MyCdpDescription"
action.retentionTimePerDay = 7.0
action.recoveryPointPerSecond = 5.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCdpPolicyAction.Result res = action.call()创建CDP任务(CreateCdpTask)
API请求
URLs
POST zstack/v1/cdp-backup-storage/taskHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "My CDP Task",
"taskType": "VM",
"policyUuid": "0a96fd4b7556333f858842dc1c2a8172",
"backupStorageUuid": "56e28fa35b7c381e8b62315b9de20bb4",
"resourceUuids": [
"672119ce84b137d58a70885c7e9f6218"
],
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"maxLatency": 1.073741824E11
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"My CDP Task","taskType":"VM","policyUuid":"0a96fd4b7556333f858842dc1c2a8172","backupStorageUuid":"56e28fa35b7c381e8b62315b9de20bb4","resourceUuids":["672119ce84b137d58a70885c7e9f6218"],"backupBandwidth":1.048576E8,"maxCapacity":1.073741824E11,"maxLatency":1.073741824E11}}' http://localhost:8080/zstack/v1/cdp-backup-storage/task参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 4.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.5.0 | |
| taskType | String | body(包含在params结构中) | CDP任务类型 | 4.5.0 | |
| policyUuid | String | body(包含在params结构中) | 权限策略UUID | 4.5.0 | |
| backupStorageUuid | String | body(包含在params结构中) | 镜像存储UUID | 4.5.0 | |
| resourceUuids | List | body(包含在params结构中) | 备份资源列表 | 4.5.0 | |
| backupBandwidth (可选) | long | body(包含在params结构中) | 单个云盘备份速率 | 4.5.0 | |
| maxCapacity (可选) | long | body(包含在params结构中) | CDP任务规划容量 | 4.5.0 | |
| maxLatency (可选) | long | body(包含在params结构中) | CDP任务RPO最大偏移量 | 4.5.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.5.0 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"uuid": "613a2bba58f03c4ba98ec089674cefaa",
"name": "My Task",
"policyUuid": "ba5ccc11257b396089abd5f00e9bac50",
"backupStorageUuid": "64a1daa72c9d3f578646517ba22e8988",
"status": "Created",
"state": "Enabled",
"taskType": "VM",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"usedCapacity": 0.0,
"maxLatency": 1.048576E8,
"currentLatency": 0.0
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpTaskInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| policyUuid | String | 权限策略UUID | 4.5.0 |
| backupStorageUuid | String | 镜像存储UUID | 4.5.0 |
| backupBandwidth | long | 单个云盘备份速率 | 4.5.0 |
| maxCapacity | long | CDP任务规划容量 | 4.5.0 |
| usedCapacity | long | CDP已用容量 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| status | CdpTaskStatus | 详情参考status | 4.5.0 |
| state | CdpTaskState | 详情参考state | 4.5.0 |
| taskType | CdpTaskType | 详情参考taskType | 4.5.0 |
| resourceRefs | List | 详情参考resourceRefs | 4.5.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Created | CdpTaskStatus | 创建 | 4.5.0 |
| Starting | CdpTaskStatus | 启动中 | 4.5.0 |
| Running | CdpTaskStatus | 运作中 | 4.5.0 |
| Stopped | CdpTaskStatus | 停止 | 4.5.0 |
| Unknown | CdpTaskStatus | 未知 | 4.5.0 |
| Failed | CdpTaskStatus | 失败 | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpTaskState | 启用 | 4.5.0 |
| Disabled | CdpTaskState | 停止 | 4.5.0 |
#taskType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| VM | CdpTaskType | 云主机 | 4.5.0 |
#resourceRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| taskUuid | String | CDP任务UUID | 4.5.0 |
| resourceUuid | String | 资源UUID | 4.5.0 |
| resourceType | String | 任务资源清单 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
CreateCdpTaskAction action = new CreateCdpTaskAction();
action.name = "My CDP Task";
action.taskType = "VM";
action.policyUuid = "0a96fd4b7556333f858842dc1c2a8172";
action.backupStorageUuid = "56e28fa35b7c381e8b62315b9de20bb4";
action.resourceUuids = asList("672119ce84b137d58a70885c7e9f6218");
action.backupBandwidth = 1.048576E8;
action.maxCapacity = 1.073741824E11;
action.maxLatency = 1.073741824E11;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateCdpTaskAction.Result res = action.call();Python
SDK
CreateCdpTaskAction action = CreateCdpTaskAction()
action.name = "My CDP Task"
action.taskType = "VM"
action.policyUuid = "0a96fd4b7556333f858842dc1c2a8172"
action.backupStorageUuid = "56e28fa35b7c381e8b62315b9de20bb4"
action.resourceUuids = [672119ce84b137d58a70885c7e9f6218]
action.backupBandwidth = 1.048576E8
action.maxCapacity = 1.073741824E11
action.maxLatency = 1.073741824E11
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateCdpTaskAction.Result res = action.call()删除CDP任务(DeleteCdpTask)
API请求
URLs
DELETE zstack/v1/cdp-task/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/cdp-task/1b6124362d023f0fb13f20923e2075d7参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| deleteMode (可选) | String | body | 删除模式 |
|
4.5.0 |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
DeleteCdpTaskAction action = new DeleteCdpTaskAction();
action.uuid = "1b6124362d023f0fb13f20923e2075d7";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCdpTaskAction.Result res = action.call();Python
SDK
DeleteCdpTaskAction action = DeleteCdpTaskAction()
action.uuid = "1b6124362d023f0fb13f20923e2075d7"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCdpTaskAction.Result res = action.call()查询CDP任务(QueryCdpTask)
API请求
URLs
GET zstack/v1/cdp-task
GET zstack/v1/cdp-task/{uuid}Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cdp-task?q=uuid=ba57edb98e983115804b74bc47e968e1curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cdp-task/8249deb879fa303b841560bf3cbd5113可查询字段
运行CLI命令行工具,输入QueryCdpTask并按Tab键查看所有可查询字段以及可跨表查询的资源名。
API返回
返回示例
{
"inventories": [
{
"uuid": "cfcb3c865b2e363f96ec43615c9862d6",
"name": "My Task",
"policyUuid": "aa3ff8d5586b39c18b330f2b118e6936",
"backupStorageUuid": "2ff526012ceb362ebfa903ba69d7a53a",
"status": "Running",
"state": "Enabled",
"taskType": "VM",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"usedCapacity": 2.395916E7
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventories | List | 详情参考inventories | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| policyUuid | String | 权限策略UUID | 4.5.0 |
| backupStorageUuid | String | 镜像存储UUID | 4.5.0 |
| backupBandwidth | long | 单个云盘备份速率 | 4.5.0 |
| maxCapacity | long | CDP任务规划容量 | 4.5.0 |
| usedCapacity | long | CDP已用容量 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 定时任务组的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 定时任务组名称 | 4.5.0 |
| description | String | 定时任务组的详细描述 | 4.5.0 |
| state | String | 定时任务组的状态 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| jobData | String | 任务参数 | 4.5.0 |
| triggersUuid | List | 触发器UUID | 4.5.0 |
| status | CdpTaskStatus | 详情参考status | 4.5.0 |
| state | CdpTaskState | 详情参考state | 4.5.0 |
| taskType | CdpTaskType | 详情参考taskType | 4.5.0 |
| resourceRefs | List | 详情参考resourceRefs | 4.5.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Created | CdpTaskStatus | 创建 | 4.5.0 |
| Starting | CdpTaskStatus | 启动中 | 4.5.0 |
| Running | CdpTaskStatus | 运作中 | 4.5.0 |
| Stopped | CdpTaskStatus | 停止 | 4.5.0 |
| Unknown | CdpTaskStatus | 未知 | 4.5.0 |
| Failed | CdpTaskStatus | 失败 | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpTaskState | 启用 | 4.5.0 |
| Disabled | CdpTaskState | 停止 | 4.5.0 |
#taskType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| VM | CdpTaskType | 云主机 | 4.5.0 |
#resourceRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| taskUuid | String | CDP任务UUID | 4.5.0 |
| resourceUuid | String | 资源UUID | 4.5.0 |
| resourceType | String | 任务资源清单 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
QueryCdpTaskAction action = new QueryCdpTaskAction();
action.conditions = asList("uuid=b3096918b9c63955a8511653e969b911");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCdpTaskAction.Result res = action.call();Python
SDK
QueryCdpTaskAction action = QueryCdpTaskAction()
action.conditions = ["uuid=6c898e4b47b93d85addd6856b0ccce67"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCdpTaskAction.Result res = action.call()更新CDP任务(UpdateCdpTask)
API请求
URLs
PUT zstack/v1/cdp-backup-storage/task/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateCdpTask": {
"name": "My CDP Task",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"maxLatency": 0.0
},
"systemTags": [],
"userTags": []
}Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateCdpTask":{"name":"My CDP Task","backupBandwidth":1.048576E8,"maxCapacity":1.073741824E11,"maxLatency":0.0}}' http://localhost:8080/zstack/v1/cdp-backup-storage/task/aa0c3f89827f3317ac7e1a9b39c6278e/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.3.6 | |
| name (可选) | String | body(包含在params结构中) | 资源名称 | 4.3.6 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.3.6 | |
| backupBandwidth (可选) | long | body(包含在params结构中) | 单个云盘备份速率 | 4.3.6 | |
| maxCapacity (可选) | long | body(包含在params结构中) | CDP任务规划容量 | 4.3.6 | |
| maxLatency (可选) | long | body(包含在params结构中) | CDP任务RPO最大偏移量 | 4.4.24 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.3.6 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.3.6 | |
| systemTags (可选) | List | body | 系统标签 | 4.3.6 | |
| userTags (可选) | List | body | 用户标签 | 4.3.6 |
API返回
返回示例
{
"inventory": {
"uuid": "2680ec1b4d0c3b69bc4c7a1813a8b3d0",
"name": "My Task",
"policyUuid": "aef28d43ccec3118bb597c237aa243ae",
"backupStorageUuid": "06f62c4b65b237ee854dbcdf01798188",
"status": "Created",
"state": "Enabled",
"taskType": "VM",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"usedCapacity": 0.0,
"maxLatency": 0.0,
"currentLatency": 0.0
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpTaskInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| policyUuid | String | 权限策略UUID | 4.5.0 |
| backupStorageUuid | String | 镜像存储UUID | 4.5.0 |
| backupBandwidth | long | 单个云盘备份速率 | 4.5.0 |
| maxCapacity | long | CDP任务规划容量 | 4.5.0 |
| usedCapacity | long | CDP已用容量 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| status | CdpTaskStatus | 详情参考status | 4.5.0 |
| state | CdpTaskState | 详情参考state | 4.5.0 |
| taskType | CdpTaskType | 详情参考taskType | 4.5.0 |
| resourceRefs | List | 详情参考resourceRefs | 4.5.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Created | CdpTaskStatus | 创建 | 4.5.0 |
| Starting | CdpTaskStatus | 启动中 | 4.5.0 |
| Running | CdpTaskStatus | 运作中 | 4.5.0 |
| Stopped | CdpTaskStatus | 停止 | 4.5.0 |
| Unknown | CdpTaskStatus | 未知 | 4.5.0 |
| Failed | CdpTaskStatus | 失败 | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpTaskState | 启用 | 4.5.0 |
| Disabled | CdpTaskState | 停止 | 4.5.0 |
#taskType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| VM | CdpTaskType | 云主机 | 4.5.0 |
#resourceRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| taskUuid | String | CDP任务UUID | 4.5.0 |
| resourceUuid | String | 资源UUID | 4.5.0 |
| resourceType | String | 任务资源清单 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
UpdateCdpTaskAction action = new UpdateCdpTaskAction();
action.uuid = "aa0c3f89827f3317ac7e1a9b39c6278e";
action.name = "My CDP Task";
action.backupBandwidth = 1.048576E8;
action.maxCapacity = 1.073741824E11;
action.maxLatency = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCdpTaskAction.Result res = action.call();Python
SDK
UpdateCdpTaskAction action = UpdateCdpTaskAction()
action.uuid = "aa0c3f89827f3317ac7e1a9b39c6278e"
action.name = "My CDP Task"
action.backupBandwidth = 1.048576E8
action.maxCapacity = 1.073741824E11
action.maxLatency = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCdpTaskAction.Result res = action.call()开启CDP任务(EnableCdpTask)
API请求
URLs
POST zstack/v1/cdp-task/enable/{uuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/cdp-task/enable/579496f57aaf3450974972479474879e参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"uuid": "0945746644d9379faddf2ac0b70147ba",
"name": "My Task",
"policyUuid": "1fdbac28c4f737db9d0579ae8859e57b",
"backupStorageUuid": "cfb2e97be9ab320594ee46d3946c356e",
"status": "Running",
"state": "Enabled",
"taskType": "VM",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"usedCapacity": 2.395916E7
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpTaskInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| policyUuid | String | 权限策略UUID | 4.5.0 |
| backupStorageUuid | String | 镜像存储UUID | 4.5.0 |
| backupBandwidth | long | 单个云盘备份速率 | 4.5.0 |
| maxCapacity | long | CDP任务规划容量 | 4.5.0 |
| usedCapacity | long | CDP已用容量 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| status | CdpTaskStatus | 详情参考status | 4.5.0 |
| state | CdpTaskState | 详情参考state | 4.5.0 |
| taskType | CdpTaskType | 详情参考taskType | 4.5.0 |
| resourceRefs | List | 详情参考resourceRefs | 4.5.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Created | CdpTaskStatus | 创建 | 4.5.0 |
| Starting | CdpTaskStatus | 启动中 | 4.5.0 |
| Running | CdpTaskStatus | 运作中 | 4.5.0 |
| Stopped | CdpTaskStatus | 停止 | 4.5.0 |
| Unknown | CdpTaskStatus | 未知 | 4.5.0 |
| Failed | CdpTaskStatus | 失败 | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpTaskState | 启用 | 4.5.0 |
| Disabled | CdpTaskState | 停止 | 4.5.0 |
#taskType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| VM | CdpTaskType | 云主机 | 4.5.0 |
#resourceRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| taskUuid | String | CDP任务UUID | 4.5.0 |
| resourceUuid | String | 资源UUID | 4.5.0 |
| resourceType | String | 任务资源清单 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
EnableCdpTaskAction action = new EnableCdpTaskAction();
action.uuid = "579496f57aaf3450974972479474879e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
EnableCdpTaskAction.Result res = action.call();Python
SDK
EnableCdpTaskAction action = EnableCdpTaskAction()
action.uuid = "579496f57aaf3450974972479474879e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
EnableCdpTaskAction.Result res = action.call()停止CDP任务(DisableCdpTask)
API请求
URLs
POST zstack/v1/cdp-task/disable/{uuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/cdp-task/disable/0f5f6a9280233fa0b5c910c27274da98参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"uuid": "e43bfb102a783c01a19ce023adaaea19",
"name": "My Task",
"policyUuid": "6ebcb0afeca13b1b99267fa6235ad632",
"backupStorageUuid": "19c774019dae3569a72b5502fddab153",
"status": "Stopped",
"state": "Disabled",
"taskType": "VM",
"backupBandwidth": 1.048576E8,
"maxCapacity": 1.073741824E11,
"usedCapacity": 2.3952346E8
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | CdpTaskInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| policyUuid | String | 权限策略UUID | 4.5.0 |
| backupStorageUuid | String | 镜像存储UUID | 4.5.0 |
| backupBandwidth | long | 单个云盘备份速率 | 4.5.0 |
| maxCapacity | long | CDP任务规划容量 | 4.5.0 |
| usedCapacity | long | CDP已用容量 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| status | CdpTaskStatus | 详情参考status | 4.5.0 |
| state | CdpTaskState | 详情参考state | 4.5.0 |
| taskType | CdpTaskType | 详情参考taskType | 4.5.0 |
| resourceRefs | List | 详情参考resourceRefs | 4.5.0 |
#status
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Created | CdpTaskStatus | 创建 | 4.5.0 |
| Starting | CdpTaskStatus | 启动中 | 4.5.0 |
| Running | CdpTaskStatus | 运作中 | 4.5.0 |
| Stopped | CdpTaskStatus | 停止 | 4.5.0 |
| Unknown | CdpTaskStatus | 未知 | 4.5.0 |
| Failed | CdpTaskStatus | 失败 | 4.5.0 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | CdpTaskState | 启用 | 4.5.0 |
| Disabled | CdpTaskState | 停止 | 4.5.0 |
#taskType
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| VM | CdpTaskType | 云主机 | 4.5.0 |
#resourceRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| taskUuid | String | CDP任务UUID | 4.5.0 |
| resourceUuid | String | 资源UUID | 4.5.0 |
| resourceType | String | 任务资源清单 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
DisableCdpTaskAction action = new DisableCdpTaskAction();
action.uuid = "0f5f6a9280233fa0b5c910c27274da98";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DisableCdpTaskAction.Result res = action.call();Python
SDK
DisableCdpTaskAction action = DisableCdpTaskAction()
action.uuid = "0f5f6a9280233fa0b5c910c27274da98"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DisableCdpTaskAction.Result res = action.call()保护云主机恢复点(ProtectVmInstanceRecoveryPoint)
API请求
URLs
PUT zstack/v1/vm-instances/{vmInstanceUuid}/protect-recovery-pointHeaders
Authorization: OAuth the-session-uuidBody
{
"protectVmInstanceRecoveryPoint": {
"groupId": 1.0,
"description": "My Awesome RP"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"protectVmInstanceRecoveryPoint":{"groupId":1.0,"description":"My Awesome RP"}}' http://localhost:8080/zstack/v1/vm-instances/8242bb6842e73987a632354acfc239ec/protect-recovery-point参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | 云主机UUID | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点唯一标识 | 4.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
ProtectVmInstanceRecoveryPointAction action = new ProtectVmInstanceRecoveryPointAction();
action.vmInstanceUuid = "8242bb6842e73987a632354acfc239ec";
action.groupId = 1.0;
action.description = "My Awesome RP";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ProtectVmInstanceRecoveryPointAction.Result res = action.call();Python
SDK
ProtectVmInstanceRecoveryPointAction action = ProtectVmInstanceRecoveryPointAction()
action.vmInstanceUuid = "8242bb6842e73987a632354acfc239ec"
action.groupId = 1.0
action.description = "My Awesome RP"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ProtectVmInstanceRecoveryPointAction.Result res = action.call()查找CDP保护恢复点(GetVmInstanceProtectedRecoveryPoints)
API请求
URLs
GET zstack/v1/vm-instances/{uuid}/protected-recovery-pointsHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/f71a2ffeec113d8e840a6808d09d1ca8/protected-recovery-points?limit=1000.0&start=0.0参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| limit (可选) | Integer | query | 查找返回的最大记录数 | 4.5.0 | |
| start (可选) | Integer | query | 查找的起始位置 | 4.5.0 | |
| systemTags (可选) | List | query | 系统标签 | 4.5.0 | |
| userTags (可选) | List | query | 用户标签 | 4.5.0 |
API返回
返回示例
{
"recoveryPoints": {
"22d49432eaf23ef0996ac976e0b91185": [
{
"id": 1.0,
"grpId": 1.0,
"size": 851968.0,
"volId": "22d49432eaf23ef0996ac976e0b91185",
"ts": "2021-06-29T19:49:45+08:00"
}
],
"71423fb28eb135c994e566badfd8aece": [
{
"id": 2.0,
"grpId": 0.0,
"size": 196608.0,
"volId": "71423fb28eb135c994e566badfd8aece",
"ts": "2021-06-29T19:49:47+08:00"
}
]
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| recoveryPoints | Map | CDP恢复点列表 | 4.5.0 |
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
SDK示例
Java
SDK
GetVmInstanceProtectedRecoveryPointsAction action = new GetVmInstanceProtectedRecoveryPointsAction();
action.uuid = "f71a2ffeec113d8e840a6808d09d1ca8";
action.limit = 1000.0;
action.start = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVmInstanceProtectedRecoveryPointsAction.Result res = action.call();Python
SDK
GetVmInstanceProtectedRecoveryPointsAction action = GetVmInstanceProtectedRecoveryPointsAction()
action.uuid = "f71a2ffeec113d8e840a6808d09d1ca8"
action.limit = 1000.0
action.start = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVmInstanceProtectedRecoveryPointsAction.Result res = action.call()解除保护云主机恢复点(UnprotectVmInstanceRecoveryPoint)
API请求
URLs
PUT zstack/v1/vm-instances/{vmInstanceUuid}/unprotect-recovery-pointHeaders
Authorization: OAuth the-session-uuidBody
{
"unprotectVmInstanceRecoveryPoint": {
"groupId": 1.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"unprotectVmInstanceRecoveryPoint":{"groupId":1.0}}' http://localhost:8080/zstack/v1/vm-instances/05beea45590e3ea5ac08d81dba36f51f/unprotect-recovery-point参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | 云主机UUID | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点唯一标识 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
返回示例
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
UnprotectVmInstanceRecoveryPointAction action = new UnprotectVmInstanceRecoveryPointAction();
action.vmInstanceUuid = "05beea45590e3ea5ac08d81dba36f51f";
action.groupId = 1.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UnprotectVmInstanceRecoveryPointAction.Result res = action.call();Python
SDK
UnprotectVmInstanceRecoveryPointAction action = UnprotectVmInstanceRecoveryPointAction()
action.vmInstanceUuid = "05beea45590e3ea5ac08d81dba36f51f"
action.groupId = 1.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UnprotectVmInstanceRecoveryPointAction.Result res = action.call()从CDP恢复点创建虚拟机(CreateVmFromCdpBackup)
API请求
URLs
PUT zstack/v1/cdp-backups/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"createVmFromCdpBackup": {
"name": "vm1",
"groupId": 224.0,
"cdpTaskUuid": "d2cb3e8626e1357aa022e05f86162987",
"instanceOfferingUuid": "cc7000d5e89936d497c7ab12c653dae3",
"l3NetworkUuids": [
"e0961ef73a7336629a0710cf8a5c1c6b"
],
"clusterUuid": "d57baa34a904394d86aa8336d8a6f9a9",
"recoverBandwidth": 0.0,
"description": "this is a vm"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"createVmFromCdpBackup":{"name":"vm1","groupId":224.0,"cdpTaskUuid":"d2cb3e8626e1357aa022e05f86162987","instanceOfferingUuid":"cc7000d5e89936d497c7ab12c653dae3","l3NetworkUuids":["e0961ef73a7336629a0710cf8a5c1c6b"],"clusterUuid":"d57baa34a904394d86aa8336d8a6f9a9","recoverBandwidth":0.0,"description":"this is a vm"}}' http://localhost:8080/zstack/v1/cdp-backups/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点ID | 4.5.0 | |
| cdpTaskUuid | String | body(包含在params结构中) | CDP任务UUID | 4.5.0 | |
| instanceOfferingUuid | String | body(包含在params结构中) | 计算规格UUID | 4.5.0 | |
| defaultL3NetworkUuid (可选) | String | body(包含在params结构中) | 默认的三层网络UUID | 4.5.0 | |
| l3NetworkUuids | List | body(包含在params结构中) | 三层网络UUID列表 | 4.5.0 | |
| type (可选) | String | body(包含在params结构中) | 虚拟机类型 |
|
4.5.0 |
| zoneUuid (可选) | String | body(包含在params结构中) | 区域UUID | 4.5.0 | |
| clusterUuid (可选) | String | body(包含在params结构中) | 集群UUID | 4.5.0 | |
| hostUuid (可选) | String | body(包含在params结构中) | 物理机UUID | 4.5.0 | |
| primaryStorageUuidForRootVolume (可选) | String | body(包含在params结构中) | 根盘对应的主存储UUID | 4.5.0 | |
| primaryStorageUuidForDataVolume (可选) | String | body(包含在params结构中) | 数据盘对应的主存储UUID | 4.5.0 | |
| recoverBandwidth (可选) | long | body(包含在params结构中) | 恢复带宽 | 4.5.0 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 4.5.0 | |
| rootVolumeSystemTags (可选) | List | body(包含在params结构中) | 系统盘的系统标签 | 4.5.0 | |
| dataVolumeSystemTags (可选) | List | body(包含在params结构中) | 数据盘的系统标签 | 4.5.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 4.5.0 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 4.5.0 | |
| systemTags (可选) | List | body | 虚拟机系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 虚拟机用户标签 | 4.5.0 |
API返回
返回示例
{
"inventory": {
"uuid": "ecadf3712d373abebb48671015a49e2c",
"name": "Test-VM",
"description": "web server VM",
"zoneUuid": "5274961ea09834f6bdc757ec9b1d205f",
"clusterUuid": "6c00cd0c676e3b5397f9e635a1357336",
"imageUuid": "e9316bbaf94a37dea9a41b8a42e30b3d",
"hostUuid": "7f2a8fe14f863e43b95b4e204d2b6073",
"lastHostUuid": "804827a4304e309a85efb214e32edd80",
"instanceOfferingUuid": "7f8ece5779ef31bab691585ffc693b91",
"rootVolumeUuid": "a2b37cf28a9834da826e14e5fd7a97c6",
"platform": "Linux",
"defaultL3NetworkUuid": "68bca6897c4f300881985f028e61ca92",
"type": "UserVm",
"hypervisorType": "KVM",
"memorySize": 8.589934592E9,
"cpuNum": 1.0,
"allocatorStrategy": "LastHostPreferredAllocatorStrategy",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Running",
"vmNics": [
{
"uuid": "645496bd84373644a52a1e62229cbb07",
"vmInstanceUuid": "ecadf3712d373abebb48671015a49e2c",
"usedIpUuid": "b89e21d52dbb3037a3ee585b253396f2",
"l3NetworkUuid": "68bca6897c4f300881985f028e61ca92",
"ip": "192.168.1.10",
"mac": "00:0c:29:bd:99:fc",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
],
"allVolumes": [
{
"uuid": "a2b37cf28a9834da826e14e5fd7a97c6",
"name": "Root-Volume-For-VM-ecadf3712d373abebb48671015a49e2c",
"primaryStorageUuid": "3626202657933f2cb13df025773d9aa9",
"vmInstanceUuid": "ecadf3712d373abebb48671015a49e2c",
"rootImageUuid": "e9316bbaf94a37dea9a41b8a42e30b3d",
"installPath": "/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-a2b37cf28a9834da826e14e5fd7a97c6/a2b37cf28a9834da826e14e5fd7a97c6.qcow2",
"type": "Root",
"format": "qcow2",
"size": 1.073741824E11,
"actualSize": 2.147483648E10,
"deviceId": 0.0,
"state": "Enabled",
"status": "Ready",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.5.0 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
| inventory | VmInstanceInventory | 详情参考inventory | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| zoneUuid | String | 区域UUID | 4.5.0 |
| clusterUuid | String | 集群UUID | 4.5.0 |
| imageUuid | String | 镜像UUID | 4.5.0 |
| hostUuid | String | 物理机UUID | 4.5.0 |
| lastHostUuid | String | 4.5.0 | |
| instanceOfferingUuid | String | 计算规格UUID | 4.5.0 |
| rootVolumeUuid | String | 根云盘UUID | 4.5.0 |
| platform | String | 4.5.0 | |
| architecture | String | 4.5.0 | |
| defaultL3NetworkUuid | String | 4.5.0 | |
| type | String | 4.5.0 | |
| hypervisorType | String | 4.5.0 | |
| memorySize | Long | 4.5.0 | |
| cpuNum | Integer | 4.5.0 | |
| cpuSpeed | Long | 4.5.0 | |
| allocatorStrategy | String | 4.5.0 | |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| state | String | 4.5.0 | |
| guestOsType | String | 4.5.0 | |
| vmNics | List | 详情参考vmNics | 4.5.0 |
| allVolumes | List | 详情参考allVolumes | 4.5.0 |
| vmCdRoms | List | 详情参考vmCdRoms | 4.5.0 |
#vmNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| vmInstanceUuid | String | 云主机UUID | 4.5.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.5.0 |
| ip | String | 4.5.0 | |
| mac | String | 4.5.0 | |
| hypervisorType | String | 4.5.0 | |
| netmask | String | 4.5.0 | |
| gateway | String | 4.5.0 | |
| metaData | String | 4.5.0 | |
| ipVersion | Integer | 4.5.0 | |
| driverType | String | 4.5.0 | |
| internalName | String | 4.5.0 | |
| deviceId | Integer | 4.5.0 | |
| type | String | 4.5.0 | |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| usedIps | List | 详情参考usedIps | 4.5.0 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| ipRangeUuid | String | IP段UUID | 4.5.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.5.0 |
| ipVersion | Integer | 4.5.0 | |
| ip | String | 4.5.0 | |
| netmask | String | 4.5.0 | |
| gateway | String | 4.5.0 | |
| usedFor | String | 4.5.0 | |
| ipInLong | long | 4.5.0 | |
| vmNicUuid | String | 云主机网卡UUID | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
#allVolumes
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| primaryStorageUuid | String | 主存储UUID | 4.5.0 |
| vmInstanceUuid | String | 云主机UUID | 4.5.0 |
| diskOfferingUuid | String | 云盘规格UUID | 4.5.0 |
| rootImageUuid | String | 4.5.0 | |
| installPath | String | 4.5.0 | |
| type | String | 4.5.0 | |
| format | String | 4.5.0 | |
| size | Long | 4.5.0 | |
| actualSize | Long | 4.5.0 | |
| deviceId | Integer | 4.5.0 | |
| state | String | 4.5.0 | |
| status | String | 4.5.0 | |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
| isShareable | Boolean | 4.5.0 | |
| volumeQos | String | 4.5.0 | |
| lastDetachDate | Timestamp | 4.5.0 | |
| lastVmInstanceUuid | String | 4.5.0 |
#vmCdRoms
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.5.0 |
| vmInstanceUuid | String | 云主机UUID | 4.5.0 |
| deviceId | Integer | 4.5.0 | |
| isoUuid | String | 4.5.0 | |
| isoInstallPath | String | 4.5.0 | |
| name | String | 资源名称 | 4.5.0 |
| description | String | 资源的详细描述 | 4.5.0 |
| createDate | Timestamp | 创建时间 | 4.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.5.0 |
SDK示例
Java
SDK
CreateVmFromCdpBackupAction action = new CreateVmFromCdpBackupAction();
action.name = "vm1";
action.groupId = 224.0;
action.cdpTaskUuid = "d2cb3e8626e1357aa022e05f86162987";
action.instanceOfferingUuid = "cc7000d5e89936d497c7ab12c653dae3";
action.l3NetworkUuids = asList("e0961ef73a7336629a0710cf8a5c1c6b");
action.clusterUuid = "d57baa34a904394d86aa8336d8a6f9a9";
action.recoverBandwidth = 0.0;
action.description = "this is a vm";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateVmFromCdpBackupAction.Result res = action.call();Python
SDK
CreateVmFromCdpBackupAction action = CreateVmFromCdpBackupAction()
action.name = "vm1"
action.groupId = 224.0
action.cdpTaskUuid = "d2cb3e8626e1357aa022e05f86162987"
action.instanceOfferingUuid = "cc7000d5e89936d497c7ab12c653dae3"
action.l3NetworkUuids = [e0961ef73a7336629a0710cf8a5c1c6b]
action.clusterUuid = "d57baa34a904394d86aa8336d8a6f9a9"
action.recoverBandwidth = 0.0
action.description = "this is a vm"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateVmFromCdpBackupAction.Result res = action.call()恢复云主机(RevertVmFromCdpBackup)
API请求
URLs
PUT zstack/v1/cdp-backups/{vmInstanceUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"revertVmFromCdpBackup": {
"backupStorageUuid": "13680e129d053ee092513efebf1ce00a",
"groupId": 1.0,
"useExistingVolume": true,
"recoverBandwidth": 0.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"revertVmFromCdpBackup":{"backupStorageUuid":"13680e129d053ee092513efebf1ce00a","groupId":1.0,"useExistingVolume":true,"recoverBandwidth":0.0}}' http://localhost:8080/zstack/v1/cdp-backups/faa5f80004b4393dbc59b91ab5a286b7/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | 云主机UUID | 4.5.0 | |
| backupStorageUuid | String | body(包含在params结构中) | 镜像存储UUID | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点唯一标识 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 | |
| primaryStorageUuidForRootVolume (可选) | String | body(包含在params结构中) | 新建根盘的主存储UUID | 4.5.0 | |
| primaryStorageUuidForDataVolume (可选) | String | body(包含在params结构中) | 新建数据盘的主存储UUID | 4.5.0 | |
| hostUuid (可选) | String | body(包含在params结构中) | 物理机UUID | 4.5.0 | |
| useExistingVolume (可选) | boolean | body(包含在params结构中) | 恢复数据是否覆盖原盘 | 4.5.0 | |
| recoverBandwidth (可选) | long | body(包含在params结构中) | 恢复带宽 | 4.5.0 |
API返回
返回示例
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK示例
Java
SDK
RevertVmFromCdpBackupAction action = new RevertVmFromCdpBackupAction();
action.vmInstanceUuid = "faa5f80004b4393dbc59b91ab5a286b7";
action.backupStorageUuid = "13680e129d053ee092513efebf1ce00a";
action.groupId = 1.0;
action.useExistingVolume = true;
action.recoverBandwidth = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevertVmFromCdpBackupAction.Result res = action.call();Python
SDK
RevertVmFromCdpBackupAction action = RevertVmFromCdpBackupAction()
action.vmInstanceUuid = "faa5f80004b4393dbc59b91ab5a286b7"
action.backupStorageUuid = "13680e129d053ee092513efebf1ce00a"
action.groupId = 1.0
action.useExistingVolume = true
action.recoverBandwidth = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevertVmFromCdpBackupAction.Result res = action.call()删除CDP任务数据(DeleteCdpTaskData)
API请求
URLs
POST zstack/v1/cdp-task/{uuid}/dataHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/cdp-task/06a058ba3bb43e91afe212bc710c559e/data参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
DeleteCdpTaskDataAction action = new DeleteCdpTaskDataAction();
action.uuid = "06a058ba3bb43e91afe212bc710c559e";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCdpTaskDataAction.Result res = action.call();Python
SDK
DeleteCdpTaskDataAction action = DeleteCdpTaskDataAction()
action.uuid = "06a058ba3bb43e91afe212bc710c559e"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCdpTaskDataAction.Result res = action.call()查找CDP恢复点(GetVmInstanceRecoveryPoints)
API请求
URLs
GET zstack/v1/vm-instances/{uuid}/recovery-pointsHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/vm-instances/e2e9f8f2184135378b883036673d1780/recovery-points?startTime=2021-06-25T15:36:16%2b08:00&limit=1000.0&start=0.0参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.5.0 | |
| startTime (可选) | String | query | 查找起始时间 | 4.5.0 | |
| endTime (可选) | String | query | 查找结束时间 | 4.5.0 | |
| scale (可选) | String | query | 查找恢复点的时间单位 |
|
4.5.0 |
| limit (可选) | Integer | query | 查找返回的最大记录数 | 4.5.0 | |
| start (可选) | Integer | query | 查找的起始位置 | 4.5.0 | |
| systemTags (可选) | List | query | 系统标签 | 4.5.0 | |
| userTags (可选) | List | query | 用户标签 | 4.5.0 |
API返回
返回示例
{
"recoveryPoints": {
"db058d634c403ffd9b55d4af14090c4b": [
{
"id": 2.0,
"grpId": 1.0,
"size": 196608.0,
"volId": "db058d634c403ffd9b55d4af14090c4b",
"ts": "2021-06-29T19:49:47+08:00"
}
],
"9092ed3354fe39ea854f2e22e0346223": [
{
"id": 1.0,
"grpId": 1.0,
"size": 851968.0,
"volId": "9092ed3354fe39ea854f2e22e0346223",
"ts": "2021-06-29T19:49:45+08:00"
}
]
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| recoveryPoints | Map | CDP恢复点列表 | 4.5.0 |
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
SDK示例
Java
SDK
GetVmInstanceRecoveryPointsAction action = new GetVmInstanceRecoveryPointsAction();
action.uuid = "e2e9f8f2184135378b883036673d1780";
action.startTime = "2021-06-25T15:36:16+08:00";
action.limit = 1000.0;
action.start = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVmInstanceRecoveryPointsAction.Result res = action.call();Python
SDK
GetVmInstanceRecoveryPointsAction action = GetVmInstanceRecoveryPointsAction()
action.uuid = "e2e9f8f2184135378b883036673d1780"
action.startTime = "2021-06-25T15:36:16+08:00"
action.limit = 1000.0
action.start = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetVmInstanceRecoveryPointsAction.Result res = action.call()挂载CDP恢复点(MountVmInstanceRecoveryPoint)
API请求
URLs
POST zstack/v1/cdp-backup-storage/mount-recovery-pointHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"vmUuid": "b21d235bb4683fa88c9cd0ac660b1b45",
"groupId": 1.0,
"https": true
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmUuid":"b21d235bb4683fa88c9cd0ac660b1b45","groupId":1.0,"https":true}}' http://localhost:8080/zstack/v1/cdp-backup-storage/mount-recovery-point参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmUuid | String | body(包含在params结构中) | 云主机UUID | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点唯一标识 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 | |
| https (可选) | boolean | body(包含在params结构中) | 是否启用https | 4.5.0 |
API返回
返回示例
{
"resourcePath": "http://cdp-storage-server/some-path"
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| resourcePath | String | 挂载恢复点成功的资源路径 | 4.5.0 |
| failedVolumes | Map | 挂载恢复点失败的云盘列表 | 4.5.0 |
| success | boolean | 成功 | 4.5.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.5.0 |
| description | String | 错误的概要描述 | 4.5.0 |
| details | String | 错误的详细信息 | 4.5.0 |
| elaboration | String | 保留字段,默认为null | 4.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.5.0 |
SDK示例
Java
SDK
MountVmInstanceRecoveryPointAction action = new MountVmInstanceRecoveryPointAction();
action.vmUuid = "b21d235bb4683fa88c9cd0ac660b1b45";
action.groupId = 1.0;
action.https = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
MountVmInstanceRecoveryPointAction.Result res = action.call();Python
SDK
MountVmInstanceRecoveryPointAction action = MountVmInstanceRecoveryPointAction()
action.vmUuid = "b21d235bb4683fa88c9cd0ac660b1b45"
action.groupId = 1.0
action.https = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
MountVmInstanceRecoveryPointAction.Result res = action.call()卸载CDP恢复点(UnmountVmInstanceRecoveryPoint)
API请求
URLs
POST zstack/v1/cdp-backup-storage/unmount-recovery-pointHeaders
Authorization: OAuth the-session-uuidBody
{
"params": {
"vmUuid": "1cd2fd6c1c6b39b3b7cb08a58cb448bc",
"groupId": 1.0
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"vmUuid":"1cd2fd6c1c6b39b3b7cb08a58cb448bc","groupId":1.0}}' http://localhost:8080/zstack/v1/cdp-backup-storage/unmount-recovery-point参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmUuid | String | body(包含在params结构中) | 云主机uuid | 4.5.0 | |
| groupId | long | body(包含在params结构中) | 恢复点唯一标识 | 4.5.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.5.0 | |
| userTags (可选) | List | body | 用户标签 | 4.5.0 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
UnmountVmInstanceRecoveryPointAction action = new UnmountVmInstanceRecoveryPointAction();
action.vmUuid = "1cd2fd6c1c6b39b3b7cb08a58cb448bc";
action.groupId = 1.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UnmountVmInstanceRecoveryPointAction.Result res = action.call();Python
SDK
UnmountVmInstanceRecoveryPointAction action = UnmountVmInstanceRecoveryPointAction()
action.vmUuid = "1cd2fd6c1c6b39b3b7cb08a58cb448bc"
action.groupId = 1.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UnmountVmInstanceRecoveryPointAction.Result res = action.call()获取备份服务器CDP运行条件(GetCdpBackupStorageRequirement)
API请求
URLs
GET zstack/v1/cdp-backup-storage/{backupStorageUuid}/requirementHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/cdp-backup-storage/ce44cb9ea12c354495fc6b4313fc90de/requirement?limit=1000&start=0参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| backupStorageUuid | String | url | 镜像存储UUID | 5.1.4 | |
| limit (可选) | Integer | query | 5.1.4 | ||
| start (可选) | Integer | query | 5.1.4 | ||
| systemTags (可选) | List | query | 系统标签 | 5.1.4 | |
| userTags (可选) | List | query | 用户标签 | 5.1.4 |
API返回
返回示例
{
"nextStep": "None",
"required": {
"qemuVersion": "6.2.0"
},
"current": {
"cdpVersion": "cdp"
}
}
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| required | Map | 期望条件 | 5.1.4 |
| current | Map | 当前条件 | 5.1.4 |
| success | boolean | 是否成功 | 5.1.4 |
| nextStep | String | 下一步骤 | 5.1.4 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.1.4 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.1.4 |
| description | String | 错误的概要描述 | 5.1.4 |
| details | String | 错误的详细信息 | 5.1.4 |
| elaboration | String | 保留字段,默认为null | 5.1.4 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.1.4 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.1.4 |
SDK示例
Java
SDK
GetCdpBackupStorageRequirementAction action = new GetCdpBackupStorageRequirementAction();
action.backupStorageUuid = "ce44cb9ea12c354495fc6b4313fc90de";
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCdpBackupStorageRequirementAction.Result res = action.call();Python
SDK
GetCdpBackupStorageRequirementAction action = GetCdpBackupStorageRequirementAction()
action.backupStorageUuid = "ce44cb9ea12c354495fc6b4313fc90de"
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCdpBackupStorageRequirementAction.Result res = action.call()升级备份服务器上的CDP任务(UpgradeBackupStorageCdpTasks)
API请求
URLs
PUT zstack/v1/cdp-task/upgrade/{backupStorageUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"upgradeBackupStorageCdpTasks": {},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"upgradeBackupStorageCdpTasks":{}}' http://localhost:8080/zstack/v1/cdp-task/upgrade/618da5c98de33bb0bc2434a80f0ab889/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| backupStorageUuid | String | url | 镜像存储UUID | 5.1.4 | |
| systemTags (可选) | List | body | 系统标签 | 5.1.4 | |
| userTags (可选) | List | body | 用户标签 | 5.1.4 |
API返回
该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}
SDK示例
Java
SDK
UpgradeBackupStorageCdpTasksAction action = new UpgradeBackupStorageCdpTasksAction();
action.backupStorageUuid = "618da5c98de33bb0bc2434a80f0ab889";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpgradeBackupStorageCdpTasksAction.Result res = action.call();Python
SDK
UpgradeBackupStorageCdpTasksAction action = UpgradeBackupStorageCdpTasksAction()
action.backupStorageUuid = "618da5c98de33bb0bc2434a80f0ab889"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpgradeBackupStorageCdpTasksAction.Result res = action.call()