从实例备份数据新建弹性裸金属实例(CreateBareMetal2InstanceFromVmBackup)
API请求
URLs
POST zstack/v1/baremetal2-instance/from/vm-backup/{groupUuid}Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"name": "New-BareMetal-Instance",
"description": "This is a bare metal instance created from vm backup.",
"zoneUuid": "ab593cddece13e78b2a1b7745870eb87",
"clusterUuid": "6d775d44d2153da9956f3173b0138646",
"gatewayUuid": "78da4dbcec473f45b002064f463a0d09",
"chassisUuid": "3b099920323a3b539df62af1af86d47c",
"chassisDiskUuid": "f705f9c189ab32bf9ad97255fe8fab55",
"primaryStorageUuidForRootVolume": "24c91178649f342283e4d7d7dfb3fe27",
"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 vm backup.","zoneUuid":"ab593cddece13e78b2a1b7745870eb87","clusterUuid":"6d775d44d2153da9956f3173b0138646","gatewayUuid":"78da4dbcec473f45b002064f463a0d09","chassisUuid":"3b099920323a3b539df62af1af86d47c","chassisDiskUuid":"f705f9c189ab32bf9ad97255fe8fab55","primaryStorageUuidForRootVolume":"24c91178649f342283e4d7d7dfb3fe27","rootVolumeSystemTags":["tag1","tag2"],"gatewayAllocatorStrategy":"DefaultAllocatorStrategy"}}' \
http://localhost:8080/zstack/v1/baremetal2-instance/from/vm-backup/a4cdc1a10d7d3e9397c01e0136bc1eab参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| 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 | |
| groupUuid | 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 | |
| primaryStorageUuidForDataVolume (可选) | String | body(包含在params结构中) | 数据云盘主存储 | 5.5.6 | |
| dataDiskOfferingUuids (可选) | List | body(包含在params结构中) | 数据云盘规格UUID | 5.5.6 | |
| rootVolumeSystemTags (可选) | List | body(包含在params结构中) | 根云盘系统标签 | 5.5.6 | |
| dataVolumeSystemTags (可选) | 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": "81554a6ff599416b9e52ced2af50f6e9",
"lastChassisUuid": "59fd7178455f479da6bc83de953898ea",
"gatewayUuid": "8fbe18d4be76461383b540611df22b7e",
"lastGatewayUuid": "d492e5b96f5a4fa88cb0ac304902f5c2",
"chassisOfferingUuid": "6ef976116b4346de88d4e70f2ff8498c",
"status": "Connected",
"provisionType": "Remote",
"agentVersion": "2.0.0",
"isLatestAgent": true,
"uuid": "3261d308bf1b4295a8bbdc1c52b08e33",
"name": "BM-1",
"description": "This is a BareMetal2 Instance.",
"zoneUuid": "d5849358f65c40518904cdbaba78b821",
"clusterUuid": "ce69c134f6344119af9faeaf6f0a735a",
"imageUuid": "9da74193c8b5413d890955fcaef694cf",
"rootVolumeUuid": "3a29abbc54c040f597469300200aaa7b",
"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
CreateBareMetal2InstanceFromVmBackupAction action = new CreateBareMetal2InstanceFromVmBackupAction();
action.name = "New-BareMetal-Instance";
action.description = "This is a bare metal instance created from vm backup.";
action.zoneUuid = "ab593cddece13e78b2a1b7745870eb87";
action.clusterUuid = "6d775d44d2153da9956f3173b0138646";
action.gatewayUuid = "78da4dbcec473f45b002064f463a0d09";
action.groupUuid = "a4cdc1a10d7d3e9397c01e0136bc1eab";
action.chassisUuid = "3b099920323a3b539df62af1af86d47c";
action.chassisDiskUuid = "f705f9c189ab32bf9ad97255fe8fab55";
action.primaryStorageUuidForRootVolume = "24c91178649f342283e4d7d7dfb3fe27";
action.rootVolumeSystemTags = asList("tag1","tag2");
action.gatewayAllocatorStrategy = "DefaultAllocatorStrategy";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBareMetal2InstanceFromVmBackupAction.Result res = action.call();Python SDK
CreateBareMetal2InstanceFromVmBackupAction action = CreateBareMetal2InstanceFromVmBackupAction()
action.name = "New-BareMetal-Instance"
action.description = "This is a bare metal instance created from vm backup."
action.zoneUuid = "ab593cddece13e78b2a1b7745870eb87"
action.clusterUuid = "6d775d44d2153da9956f3173b0138646"
action.gatewayUuid = "78da4dbcec473f45b002064f463a0d09"
action.groupUuid = "a4cdc1a10d7d3e9397c01e0136bc1eab"
action.chassisUuid = "3b099920323a3b539df62af1af86d47c"
action.chassisDiskUuid = "f705f9c189ab32bf9ad97255fe8fab55"
action.primaryStorageUuidForRootVolume = "24c91178649f342283e4d7d7dfb3fe27"
action.rootVolumeSystemTags = [tag1, tag2]
action.gatewayAllocatorStrategy = "DefaultAllocatorStrategy"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateBareMetal2InstanceFromVmBackupAction.Result res = action.call()