更新镜像信息
Headers
Authorization: OAuth the-session-uuidBody
{
"updateImage": {
"platform": "Windows",
"virtio": false
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateImage":{"platform":"Windows","virtio":false}}' http://localhost:8080/zstack/v1/images/38549d5d5a3d3c5caefc18d8a9e0aa13/actions参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
uuid | String | url | 镜像的UUID,唯一标示该镜像 |
| 0.6 |
name (可选) | String | body(包含在params结构中) | 镜像名称 |
| 0.6 |
description (可选) | String | body(包含在params结构中) | 镜像的详细描述 |
| 0.6 |
guestOsType (可选) | String | body(包含在params结构中) | 镜像对应的客户机操作系统类型 |
| 0.6 |
mediaType (可选) | String | body(包含在params结构中) | 镜像的类型 |
| 0.6 |
format (可选) | String | body(包含在params结构中) | 镜像的格式 |
| 0.6 |
system (可选) | Boolean | body(包含在params结构中) | 标识是否为系统镜像 |
| 0.6 |
platform (可选) | String | body(包含在params结构中) | 镜像的系统平台 |
| 0.6 |
architecture(可选) | String | body(包含在updateImage结构中) |
|
| 4.0.0 |
systemTags (可选) | List | body | 系统标签 |
| 0.6 |
userTags (可选) | List | body | 用户标签 |
| 0.6 |
API返回
返回示例
{
"inventory": {
"uuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Windows",
"architecture": "x86_64",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "fadea0efc22e3e6fa43f537f1af6ee6b",
"backupStorageUuid": "b94ff32725d133fea53e8ada5ea7f0fc",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventory | ImageInventory | 详情参考inventory | 0.6 |
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 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| state | String | 镜像的启动状态 | 4.0.0 |
| status | String | 镜像的就绪状态 | 4.0.0 |
| size | Long | 镜像大小 | 4.0.0 |
| actualSize | Long | 镜像真实容量 | 4.0.0 |
| md5Sum | String | 镜像的md5值 | 4.0.0 |
| url | String | 镜像的URL地址 | 4.0.0 |
| mediaType | String | 镜像的类型 | 4.0.0 |
| guestOsType | String | 镜像对应的客户机操作系统类型 | 4.0.0 |
| type | String | 内部使用字段 | 4.0.0 |
| platform | String | 镜像的系统平台 | 4.0.0 |
| format | String | 镜像的格式,比如:raw | 4.0.0 |
| system | Boolean | 标识是否为系统镜像 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| backupStorageRefs | List | 详情参考backupStorageRefs | 0.6 |
backupStorageRefs
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| imageUuid | String | 镜像UUID | 0.6 |
| backupStorageUuid | String | 镜像存储UUID | 0.6 |
| installPath | String | 在镜像仓库上的安装路径 | 4.0.0 |
| exportUrl | String | 导出镜像的url | 4.0.0 |
| exportMd5Sum | String | 导出镜像的md5值 | 4.0.0 |
| status | String | 镜像就绪状态 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
SDK示例
Java SDK
UpdateImageAction action = new UpdateImageAction();
action.uuid = "38549d5d5a3d3c5caefc18d8a9e0aa13";
action.platform = "Windows";
action.virtio = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateImageAction.Result res = action.call();Python SDK
UpdateImageAction action = UpdateImageAction()
action.uuid = "38549d5d5a3d3c5caefc18d8a9e0aa13"
action.platform = "Windows"
action.virtio = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateImageAction.Result res = action.call()