创建根盘镜像(CreateRootVolumeTemplateFromVolumeBackup)
从卷备份创建根云盘镜像。
API请求
URLs
POST zstack/v1/images/root-volume-templates/from/volume-template/{backupUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"backupStorageUuid": "9681bf8631a133ccb84fc5cf6ff7aaa6",
"name": "template",
"description": "root template from volume backup",
"system": false
},
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"backupStorageUuid":"9681bf8631a133ccb84fc5cf6ff7aaa6","name":"template","description":"root template from volume backup","system":false}}' http://localhost:8080/zstack/v1/images/root-volume-templates/from/volume-template/84eccd458028338d8f5eb72efdc6f8a7
参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
---|---|---|---|---|---|
backupUuid | String | url | 卷备份uuid | 2.6.0 | |
backupStorageUuid | String | body(包含在params结构中) | 镜像存储UUID | 2.6.0 | |
name | String | body(包含在params结构中) | 资源名称 | 2.6.0 | |
description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 2.6.0 | |
guestOsType (可选) | String | body(包含在params结构中) | 宿主机操作系统类型 | 2.6.0 | |
platform (可选) | String | body(包含在params结构中) | 镜像平台类型 |
|
2.6.0 |
system (可选) | boolean | body(包含在params结构中) | 是否系统镜像 | 2.6.0 | |
resourceUuid (可选) | String | body(包含在params结构中) | 指定资源uuid | 2.6.0 | |
systemTags (可选) | List | body | 系统标签 | 2.6.0 | |
userTags (可选) | List | body | 用户标签 | 2.6.0 |
API返回
返回示例
{
"inventory": {
"uuid": "e2b2695d55243c2997b5dc6165fffa83",
"name": "My Volume Template",
"mediaType": "RootVolumeTemplate",
"platform": "Linux",
"format": "qcow2",
"backupStorageRefs": [
{
"id": 0.0,
"imageUuid": "e2b2695d55243c2997b5dc6165fffa83",
"backupStorageUuid": "4ed18086e5593b86932436d02f575213",
"installPath": "zstore://centos/0cd599ec519249489475112a058bb93a",
"status": "Ready"
}
]
}
}
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 2.6.0 |
inventory | ImageInventory | 详情参考inventory | 2.6.0 |
#error
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 2.6.0 |
description | String | 错误的概要描述 | 2.6.0 |
details | String | 错误的详细信息 | 2.6.0 |
elaboration | String | 保留字段,默认为null | 2.6.0 |
opaque | LinkedHashMap | 保留字段,默认为null | 2.6.0 |
cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 2.6.0 |
#inventory
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
uuid | String | 资源的UUID,唯一标示该资源 | 2.6.0 |
name | String | 资源名称 | 2.6.0 |
description | String | 资源的详细描述 | 2.6.0 |
exportUrl | String | 2.6.0 | |
exportMd5Sum | String | 2.6.0 | |
state | String | 2.6.0 | |
status | String | 2.6.0 | |
size | Long | 2.6.0 | |
actualSize | Long | 2.6.0 | |
md5Sum | String | 2.6.0 | |
url | String | 2.6.0 | |
mediaType | String | 2.6.0 | |
guestOsType | String | 2.6.0 | |
type | String | 2.6.0 | |
platform | String | 2.6.0 | |
format | String | 2.6.0 | |
system | Boolean | 2.6.0 | |
createDate | Timestamp | 创建时间 | 2.6.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 2.6.0 |
backupStorageRefs | List | 详情参考backupStorageRefs | 2.6.0 |
#backupStorageRefs
名字 | 类型 | 描述 | 起始版本 |
---|---|---|---|
imageUuid | String | 镜像UUID | 2.6.0 |
backupStorageUuid | String | 镜像存储UUID | 2.6.0 |
installPath | String | 2.6.0 | |
status | String | 2.6.0 | |
createDate | Timestamp | 创建时间 | 2.6.0 |
lastOpDate | Timestamp | 最后一次修改时间 | 2.6.0 |
SDK示例
Java
SDK
CreateRootVolumeTemplateFromVolumeBackupAction action = new CreateRootVolumeTemplateFromVolumeBackupAction();
action.backupUuid = "84eccd458028338d8f5eb72efdc6f8a7";
action.backupStorageUuid = "9681bf8631a133ccb84fc5cf6ff7aaa6";
action.name = "template";
action.description = "root template from volume backup";
action.system = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateRootVolumeTemplateFromVolumeBackupAction.Result res = action.call();
Python
SDK
CreateRootVolumeTemplateFromVolumeBackupAction action = CreateRootVolumeTemplateFromVolumeBackupAction()
action.backupUuid = "84eccd458028338d8f5eb72efdc6f8a7"
action.backupStorageUuid = "9681bf8631a133ccb84fc5cf6ff7aaa6"
action.name = "template"
action.description = "root template from volume backup"
action.system = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateRootVolumeTemplateFromVolumeBackupAction.Result res = action.call()