虚拟机相关接口
获取虚拟机可加载ISO列表
获取一个虚拟机以加载的ISO列表。
Headers
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fe731654cc114cc3b0cc1cb0bd437f77" \
-X GET http://localhost:8080/zstack/v1/vm-instances/1f65bf61248341708265de7d759828b2/iso-candidates参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| vmInstanceUuid | String | url | 虚拟机UUID | 0.6 | |
| systemTags (可选) | List | query | 系统标签 | 0.6 | |
| userTags (可选) | List | query | 用户标签 | 0.6 |
API返回
返回示例
{
"inventories": [
{
"uuid": "cb2c34a46a753c5ab95807fabbae56af",
"name": "TinyLinux",
"url": "http://192.168.1.20/share/images/tinylinux.qcow2",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0,
"imageUuid": "cb2c34a46a753c5ab95807fabbae56af",
"backupStorageUuid": "217396177c143e49ad21dd5679e28a61",
"installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
"status": "Ready"
}
]
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 0.6 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 0.6 |
| inventories | List | 详情参考inventories | 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 |
inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| state | String | 镜像的启动状态 | 0.6 |
| status | String | 镜像的就绪状态 | 0.6 |
| size | Long | 镜像大小 | 0.6 |
| actualSize | Long | 镜像真实容量 | 0.6 |
| md5Sum | String | 镜像的md5值 | 0.6 |
| url | String | 镜像的URL地址 | 0.6 |
| mediaType | String | 镜像的类型 | 0.6 |
| guestOsType | String | 镜像对应的客户机操作系统类型 | 0.6 |
| type | String | 内部使用字段 | 0.6 |
| platform | String | 镜像的系统平台 | 0.6 |
| format | String | 镜像的格式,比如:raw | 0.6 |
| system | Boolean | 标识是否为系统镜像 | 0.6 |
| 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 | 在镜像存储上的安装路径 | 0.6 |
| exportUrl | String | 导出镜像的url | 0.6 |
| exportMd5Sum | String | 导出镜像的md5值 | 0.6 |
| status | String | 镜像就绪状态 | 0.6 |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
SDK示例
Java SDK
GetCandidateIsoForAttachingVmAction action = new GetCandidateIsoForAttachingVmAction();
action.vmInstanceUuid = "a314c7a1ee9937ba94bd9fcc9a02e727";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateIsoForAttachingVmAction.Result res = action.call();Python SDK
GetCandidateIsoForAttachingVmAction action = GetCandidateIsoForAttachingVmAction()
action.vmInstanceUuid = "a314c7a1ee9937ba94bd9fcc9a02e727"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateIsoForAttachingVmAction.Result res = action.call()