从云盘备份数据新建弹性裸金属实例(CreateBareMetal2InstanceFromVolumeBackup)
API请求
URLs
POST zstack/v1/baremetal2-instance/from/volume-backup/{backupUuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "New-BareMetal-Instance",
"description": "This is a bare metal instance created from volume backup.",
"zoneUuid": "a6bd3e3415303e0ba10093587062da90",
"clusterUuid": "fbbb8afe94e73e6384eb42806a81bbfa",
"gatewayUuid": "d1cda3e4e0453703a8c1743e570680ee",
"chassisUuid": "c40496c747af3710aec065a4a993c0a0",
"chassisDiskUuid": "17e8555e857b38cebe935db9af3f2df6",
"primaryStorageUuidForRootVolume": "2d21e7bd7c273be4bc630f15aa82e708",
"rootVolumeSystemTags": [
"tag1",
"tag2"
],
"gatewayAllocatorStrategy": "DefaultAllocatorStrategy"
},
"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":"New-BareMetal-Instance","description":"This is a bare metal instance created from volume backup.","zoneUuid":"a6bd3e3415303e0ba10093587062da90","clusterUuid":"fbbb8afe94e73e6384eb42806a81bbfa","gatewayUuid":"d1cda3e4e0453703a8c1743e570680ee","chassisUuid":"c40496c747af3710aec065a4a993c0a0","chassisDiskUuid":"17e8555e857b38cebe935db9af3f2df6","primaryStorageUuidForRootVolume":"2d21e7bd7c273be4bc630f15aa82e708","rootVolumeSystemTags":["tag1","tag2"],"gatewayAllocatorStrategy":"DefaultAllocatorStrategy"}}' \
http://localhost:8080/zstack/v1/baremetal2-instance/from/volume-backup/03a77b5d079a3d1da607e6fcca155a67参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| name | String | body(包含在params结构中) | 资源名称 | 5.5.6 | |
| description (可选) | String | body(包含在params结构中) | 资源的详细描述 | 5.5.6 | |
| zoneUuid (可选) | String | body(包含在params结构中) | 区域UUID | 5.5.6 | |
| clusterUuid (可选) | String | body(包含在params结构中) | 集群UUID | 5.5.6 | |
| gatewayUuid (可选) | String | body(包含在params结构中) | 裸金属网关节点UUID | 5.5.6 | |
| backupUuid | String | url | 备份数据UUID | 5.5.6 | |
| chassisUuid (可选) | String | body(包含在params结构中) | 裸金属节点UUID | 5.5.6 | |
| chassisOfferingUuid (可选) | String | body(包含在params结构中) | 裸金属规格UUID Note: 对于参数chassisUuid和chassisOfferingUuid,两者至少要设置一个。 |
5.5.6 | |
| chassisDiskUuid (可选) | String | body(包含在params结构中) | 5.5.6 | ||
| primaryStorageUuidForRootVolume (可选) | String | body(包含在params结构中) | 根云盘主存储 | 5.5.6 | |
| rootVolumeSystemTags (可选) | List | body(包含在params结构中) | 根云盘系统标签 | 5.5.6 | |
| gatewayAllocatorStrategy (可选) | String | body(包含在params结构中) | 裸金属网关节点分配策略 | 5.5.6 | |
| resourceUuid (可选) | String | body(包含在params结构中) | 资源UUID | 5.5.6 | |
| tagUuids (可选) | List | body(包含在params结构中) | 标签UUID列表 | 5.5.6 | |
| systemTags (可选) | List | body | 系统标签 | 5.5.6 | |
| userTags (可选) | List | body | 用户标签 | 5.5.6 |
API返回
返回示例
{
"inventory": {
"chassisUuid": "81f62f9cd29e4a6f9b30e7acb5f37f2a",
"lastChassisUuid": "aa573d1305ea427bbffc35ea64bfe644",
"gatewayUuid": "f8d24330e04c42749fb415a68a4826a8",
"lastGatewayUuid": "bc826d08dba54bae9b85fcaa1e35591f",
"chassisOfferingUuid": "7ad393f46f6e4794ada11efbc22ec5b2",
"status": "Connected",
"provisionType": "Remote",
"agentVersion": "2.0.0",
"isLatestAgent": true,
"uuid": "69dabbb90a6f4aa889c947a2107cfbdd",
"name": "BM-1",
"description": "This is a BareMetal2 Instance.",
"zoneUuid": "50a7b341788b41f086bd92d51691ad2d",
"clusterUuid": "8086e39efdec45b8a9e2ed6738b6609f",
"imageUuid": "66516c70956642a189420900a33d3aeb",
"rootVolumeUuid": "0f1c76cbb51a481e9a978fad78b437b4",
"platform": "Linux",
"type": "baremetal2",
"memorySize": 8589934592,
"cpuNum": 8,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Running"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 5.5.6 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.5.6 |
| inventory | BareMetal2InstanceInventory | 详情参考inventory | 5.5.6 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| chassisUuid | String | 裸金属节点UUID | 4.0.0 |
| lastChassisUuid | String | 上次所在裸金属节点UUID | 4.0.0 |
| gatewayUuid | String | 裸金属网关节点UUID | 4.0.0 |
| lastGatewayUuid | String | 上次所在裸金属网关节点UUID | 4.0.0 |
| chassisOfferingUuid | String | 裸金属节点规格UUID | 4.0.0 |
| gatewayAllocatorStrategy | String | 裸金属网关节点分配策略 | 4.0.0 |
| status | String | 连接状态 | 4.0.0 |
| provisionType | String | 4.7.13 | |
| agentVersion | String | 4.7.13 | |
| isLatestAgent | boolean | 4.7.13 | |
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| name | String | 资源名称 | 4.0.0 |
| description | String | 资源的详细描述 | 4.0.0 |
| zoneUuid | String | 区域UUID | 4.0.0 |
| clusterUuid | String | 集群UUID | 4.0.0 |
| imageUuid | String | 镜像UUID | 4.0.0 |
| hostUuid | String | 物理机UUID | 4.7.13 |
| lastHostUuid | String | 4.7.13 | |
| instanceOfferingUuid | String | 计算规格UUID | 4.7.13 |
| rootVolumeUuid | String | 根云盘UUID | 4.0.0 |
| platform | String | 平台类型 | 4.0.0 |
| architecture | String | 4.7.13 | |
| defaultL3NetworkUuid | String | 默认网络UUID | 4.0.0 |
| type | String | 类型 | 4.0.0 |
| hypervisorType | String | 虚拟化类型 | 4.0.0 |
| memorySize | Long | 内存容量 | 4.0.0 |
| cpuNum | Integer | CPU核数 | 4.0.0 |
| cpuSpeed | Long | CPU速率 | 4.0.0 |
| allocatorStrategy | String | 4.7.13 | |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| state | String | 运行状态 | 4.0.0 |
| guestOsType | String | 4.7.13 | |
| provisionNics | BareMetal2InstanceProvisionNicInventory | 详情参考provisionNics | 4.0.0 |
| vmNics | List | 详情参考vmNics | 4.0.0 |
| allVolumes | List | 详情参考allVolumes | 4.0.0 |
| vmCdRoms | List | 详情参考vmCdRoms | 4.7.13 |
#provisionNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| networkUuid | String | 裸金属部署网络UUID | 4.0.0 |
| mac | String | MAC地址 | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| netmask | String | 子网掩码 | 4.0.0 |
| gateway | String | 网关地址 | 4.0.0 |
| metadata | String | 4.0.0 | |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
#vmNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| l3NetworkUuid | String | 三层网络UUID | 4.7.13 |
| ip | String | 4.7.13 | |
| mac | String | 4.7.13 | |
| hypervisorType | String | 4.7.13 | |
| netmask | String | 4.7.13 | |
| gateway | String | 4.7.13 | |
| metaData | String | 4.7.13 | |
| ipVersion | Integer | 4.7.13 | |
| driverType | String | 4.7.13 | |
| internalName | String | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| type | String | 4.7.13 | |
| state | String | 网卡状态 | 4.7.13 |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
| usedIps | List | 详情参考usedIps | 4.7.13 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 5.0.0 |
| ipRangeUuid | String | IP段UUID | 5.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 5.0.0 |
| ipVersion | Integer | 5.0.0 | |
| ip | String | 5.0.0 | |
| netmask | String | 5.0.0 | |
| gateway | String | 5.0.0 | |
| usedFor | String | 分配原因 | 5.0.0 |
| ipInLong | long | 5.0.0 | |
| ipInBinary | byte[] | 5.2.0 | |
| vmNicUuid | String | 云主机网卡UUID | 5.0.0 |
| createDate | Timestamp | 创建时间 | 5.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.0.0 |
#allVolumes
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| name | String | 资源名称 | 4.7.13 |
| description | String | 资源的详细描述 | 4.7.13 |
| primaryStorageUuid | String | 主存储UUID | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| diskOfferingUuid | String | 云盘规格UUID | 4.7.13 |
| rootImageUuid | String | 4.7.13 | |
| installPath | String | 4.7.13 | |
| type | String | 4.7.13 | |
| format | String | 4.7.13 | |
| size | Long | 4.7.13 | |
| actualSize | Long | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| state | String | 4.7.13 | |
| status | String | 4.7.13 | |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
| isShareable | Boolean | 4.7.13 | |
| volumeQos | String | 4.7.13 | |
| lastDetachDate | Timestamp | 4.7.13 | |
| lastVmInstanceUuid | String | 4.7.13 |
#vmCdRoms
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| deviceId | Integer | 4.7.13 | |
| isoUuid | String | 4.7.13 | |
| isoInstallPath | String | 4.7.13 | |
| name | String | 资源名称 | 4.7.13 |
| description | String | 资源的详细描述 | 4.7.13 |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 5.3.20 |
| description | String | 错误的概要描述 | 5.3.20 |
| details | String | 错误的详细信息 | 5.3.20 |
| elaboration | String | 保留字段,默认为null | 5.3.20 |
| opaque | LinkedHashMap | 保留字段,默认为null | 5.3.20 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 5.3.20 |
SDK示例
Java SDK
CreateBareMetal2InstanceFromVolumeBackupAction action = new CreateBareMetal2InstanceFromVolumeBackupAction();
action.name = "New-BareMetal-Instance";
action.description = "This is a bare metal instance created from volume backup.";
action.zoneUuid = "a6bd3e3415303e0ba10093587062da90";
action.clusterUuid = "fbbb8afe94e73e6384eb42806a81bbfa";
action.gatewayUuid = "d1cda3e4e0453703a8c1743e570680ee";
action.backupUuid = "03a77b5d079a3d1da607e6fcca155a67";
action.chassisUuid = "c40496c747af3710aec065a4a993c0a0";
action.chassisDiskUuid = "17e8555e857b38cebe935db9af3f2df6";
action.primaryStorageUuidForRootVolume = "2d21e7bd7c273be4bc630f15aa82e708";
action.rootVolumeSystemTags = asList("tag1","tag2");
action.gatewayAllocatorStrategy = "DefaultAllocatorStrategy";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBareMetal2InstanceFromVolumeBackupAction.Result res = action.call();Python SDK
CreateBareMetal2InstanceFromVolumeBackupAction action = CreateBareMetal2InstanceFromVolumeBackupAction()
action.name = "New-BareMetal-Instance"
action.description = "This is a bare metal instance created from volume backup."
action.zoneUuid = "a6bd3e3415303e0ba10093587062da90"
action.clusterUuid = "fbbb8afe94e73e6384eb42806a81bbfa"
action.gatewayUuid = "d1cda3e4e0453703a8c1743e570680ee"
action.backupUuid = "03a77b5d079a3d1da607e6fcca155a67"
action.chassisUuid = "c40496c747af3710aec065a4a993c0a0"
action.chassisDiskUuid = "17e8555e857b38cebe935db9af3f2df6"
action.primaryStorageUuidForRootVolume = "2d21e7bd7c273be4bc630f15aa82e708"
action.rootVolumeSystemTags = [tag1, tag2]
action.gatewayAllocatorStrategy = "DefaultAllocatorStrategy"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateBareMetal2InstanceFromVolumeBackupAction.Result res = action.call()