上传软件包到镜像存储
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "software-package-name",
"type": "ZMigrate",
"backupStorageUuid": "ff081de062bd338eb907962028e64d00",
"url": "http://192.168.1.1/disk/images/test.qcow2",
"installPath": "/root/zmigrate.tar.gz"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"software-package-name","type":"ZMigrate","backupStorageUuid":"ff081de062bd338eb907962028e64d00","url":"http://192.168.1.1/disk/images/test.qcow2","installPath":"/root/zmigrate.tar.gz"}}' \
http://localhost:8080/zstack/v1/software-packages/backup-storage/upload参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 5.0.0 | |
| type | String | body(包含在params结构中) | 软件包类型 | 5.0.0 | |
| backupStorageUuid (可选) | String | body(包含在params结构中) | 镜像存储UUID | 5.0.0 | |
| url | String | body(包含在params结构中) | 软件包URL | 5.0.0 | |
| installPath | String | body(包含在params结构中) | 安装路径 | 5.0.0 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 5.0.0 | |
| tagUuids (可选) | String | body(包含在params结构中) | 标签UUID列表 | 5.0.0 | |
| systemTags (可选) | List | body | 系统标签 | 5.0.0 | |
| userTags (可选) | List | body | 用户标签 | 5.0.0 |
API返回
返回示例
{
"inventory": {
"size": 0
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 5.0.0 | |
| inventory | SoftwarePackageInventory | 详情参考inventory | 5.0.0 |
| error | ErrorCode | 详情参考error | 5.0.0 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.10.20 |
| name | String | 资源名称 | 4.10.20 |
| hostUuid | String | 物理机UUID | 4.10.20 |
| managementNodeUuid | String | 上传到管理节点UUID | 4.10.20 |
| installPath | String | 安装路径 | 4.10.20 |
| unzipInstallPath | String | 解压安装路径 | 4.10.20 |
| type | String | 安装包类型 | 4.10.20 |
| md5sum | String | 安装包MD5校验值 | 4.10.20 |
| status | String | 安装包状态 | 4.10.20 |
| size | long | 安装包大小 | 4.10.20 |
| createDate | Timestamp | 创建时间 | 4.10.20 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.10.20 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
SDK示例
Java SDK
UploadSoftwarePackageToBackupStorageAction action = new UploadSoftwarePackageToBackupStorageAction();
action.name = "software-package-name";
action.type = "ZMigrate";
action.backupStorageUuid = "ff081de062bd338eb907962028e64d00";
action.url = "http://192.168.1.1/disk/images/test.qcow2";
action.installPath = "/root/zmigrate.tar.gz";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UploadSoftwarePackageToBackupStorageAction.Result res = action.call();Python SDK
action = UploadSoftwarePackageToBackupStorageAction()
action.name = "software-package-name"
action.type = "ZMigrate"
action.backupStorageUuid = "ff081de062bd338eb907962028e64d00"
action.url = "http://192.168.1.1/disk/images/test.qcow2"
action.installPath = "/root/zmigrate.tar.gz"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()