更新弹性裸金属实例(UpdateBareMetal2Instance)
API请求
URLs
PUT /v1/baremetal2/bm-instances/{uuid}/actionHeaders
Authorization: OAuth the-session-uuidBody
{
"updateBareMetal2Instance": {
"name": "new-bm2-instance-name",
"description": "new-bm2-instance-description",
"state": "Running",
"chassisOfferingUuid": "75f357e1c7d931f8977c44cf6e472088",
"defaultL3NetworkUuid": "93b3ad570c9238568da83b838e41b944",
"autoReleaseChassisEvent": "enable"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBareMetal2Instance":{"name":"new-bm2-instance-name","description":"new-bm2-instance-description","state":"Running","chassisOfferingUuid":"75f357e1c7d931f8977c44cf6e472088","defaultL3NetworkUuid":"93b3ad570c9238568da83b838e41b944","autoReleaseChassisEvent":"enable"}}' http://localhost:8080/zstack/v1/baremetal2/bm-instances/fe3ee28c03793c57b64c5cc76e096566/action参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.0.0 | |
| name(可选) | String | body(包含在updateBareMetal2Instance结构中) | 资源名称 | 4.0.0 | |
| description (可选) | String | body(包含在updateBareMetal2Instance结构中) | 资源的详细描述 | 4.0.0 | |
| state(可选) | body(包含在updateBareMetal2Instance结构中) | 运行状态 |
|
||
| chassisOfferingUuid (可选) | String | body(包含在updateBareMetal2Instance结构中) | 节点规格UUID | 4.0.0 | |
| defaultL3NetworkUuid(可选) | String | body(包含在updateBareMetal2Instance结构中) | 默认网络UUID | 4.0.0 | |
| autoReleaseChassisEvent (可选) | String | body(包含在updateBareMetal2Instance结构中) | 关机自动释放节点 |
|
4.0.0 |
| systemTags (可选) | List | body | 系统标签 | 4.0.0 | |
| userTags (可选) | List | body | 用户标签 | 4.0.0 |
API返回
返回示例
{
"inventory": {
"chassisUuid": "7453e747768542489c23050886938b77",
"lastChassisUuid": "b39799cc4126488aa17814ea424a3dd7",
"gatewayUuid": "196bf822c5e349adabf8794d9cb5e75c",
"lastGatewayUuid": "350145e2738d44e9a5167eeb478cae00",
"chassisOfferingUuid": "2d45764c371d49f48431f018618eb10b",
"status": "Connected",
"uuid": "d9fe21f56dfb414494d1b09905f19179",
"name": "BM-1",
"description": "This is a BareMetal2 Instance.",
"zoneUuid": "d02a19753dfa4ee4ad43597c7e6d3a73",
"clusterUuid": "966745e8fa264ca4811096a530202acd",
"imageUuid": "02a4dc10172f4652bc160d4f8e397aee",
"rootVolumeUuid": "f86494fac7714dad95bf90732e9bd319",
"platform": "Linux",
"type": "baremetal2",
"memorySize": 8.589934592E9,
"cpuNum": 8.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Running"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.0.0 |
| inventory | BareMetal2InstanceInventory | 详情参考inventory | 4.0.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.0.0 |
| description | String | 错误的概要描述 | 4.0.0 |
| details | String | 错误的详细信息 | 4.0.0 |
| elaboration | String | 保留字段,默认为null | 4.0.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.0.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.0.0 |
#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 |
| 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 |
| rootVolumeUuid | String | 根云盘UUID | 4.0.0 |
| platform | String | 平台类型 | 4.0.0 |
| 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 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| state | String | 运行状态 | 4.0.0 |
| provisionNic | BareMetal2InstanceProvisionNicInventory | 详情参考provisionNic | 4.0.0 |
| vmNics | List | 详情参考vmNics | 4.0.0 |
| allVolumes | List | 详情参考allVolumes | 4.0.0 |
#provisionNic
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| 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.0.0 |
| vmInstanceUuid | String | 云主机UUID | 4.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| mac | String | MAC地址 | 4.0.0 |
| hypervisorType | String | 虚拟化类型 | 4.0.0 |
| netmask | String | 子网掩码 | 4.0.0 |
| gateway | String | 网关 | 4.0.0 |
| metaData | String | 4.0.0 | |
| ipVersion | Integer | IP地址版本 | 4.0.0 |
| deviceId | Integer | 设备ID | 4.0.0 |
| type | String | 网卡类型 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| usedIps | List | 详情参考usedIps | 4.0.0 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| ipRangeUuid | String | IP段UUID | 4.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.0.0 |
| ipVersion | Integer | IP协议号 | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| netmask | String | 网络掩码 | 4.0.0 |
| gateway | String | 网关地址 | 4.0.0 |
| usedFor | String | 4.0.0 | |
| ipInLong | long | 4.0.0 | |
| vmNicUuid | String | 云主机网卡UUID | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
#allVolumes
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| name | String | 资源名称 | 4.0.0 |
| description | String | 资源的详细描述 | 4.0.0 |
| primaryStorageUuid | String | 主存储UUID | 4.0.0 |
| vmInstanceUuid | String | 云主机UUID | 4.0.0 |
| diskOfferingUuid | String | 云盘规格UUID | 4.0.0 |
| rootImageUuid | String | 云盘根镜像UUID | 4.0.0 |
| installPath | String | 云盘在主存储上的路径 | 4.0.0 |
| type | String | 云盘类型,数据云盘/根云盘 | 4.0.0 |
| format | String | 云盘格式 | 4.0.0 |
| size | Long | 云盘大小 | 4.0.0 |
| actualSize | Long | 云盘真实大小 | 4.0.0 |
| deviceId | Integer | 4.0.0 | |
| state | String | 云盘是否开启 | 4.0.0 |
| status | String | 云盘状态 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| isShareable | Boolean | 是否共享云盘 | 4.0.0 |
| volumeQos | String | 云盘Qos,格式如total=1048576 | 4.0.0 |
SDK示例
Java
SDK
UpdateBareMetal2InstanceAction action = new UpdateBareMetal2InstanceAction();
action.uuid = "fe3ee28c03793c57b64c5cc76e096566";
action.name = "new-bm2-instance-name";
action.description = "new-bm2-instance-description";
action.state = "Running";
action.chassisOfferingUuid = "75f357e1c7d931f8977c44cf6e472088";
action.defaultL3NetworkUuid = "93b3ad570c9238568da83b838e41b944";
action.autoReleaseChassisEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBareMetal2InstanceAction.Result res = action.call();Python
SDK
UpdateBareMetal2InstanceAction action = UpdateBareMetal2InstanceAction()
action.uuid = "fe3ee28c03793c57b64c5cc76e096566"
action.name = "new-bm2-instance-name"
action.description = "new-bm2-instance-description"
action.state = "Running"
action.chassisOfferingUuid = "75f357e1c7d931f8977c44cf6e472088"
action.defaultL3NetworkUuid = "93b3ad570c9238568da83b838e41b944"
action.autoReleaseChassisEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateBareMetal2InstanceAction.Result res = action.call()