修改虚拟机VF网卡高可用状态
Headers
Authorization: OAuth the-session-uuidBody
{
"changeVfNicHaState": {
"haState": "Enabled"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeVfNicHaState":{"haState":"Enabled"}}' \
http://localhost:8080/zstack/v1/vm-instances/nics/8536b111015d3fd289907c5f53c80153/actions参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
vfNicUuid | String | url | VF网卡UUID |
| 4.10.0 |
haState | String | body(包含在 | 高可用状态 |
| 4.10.0 |
systemTags (可选) | List | body | 系统标签 |
| 4.10.0 |
userTags (可选) | List | body | 用户标签 |
| 4.10.0 |
API返回
返回示例
{
"inventory": {
"pciDeviceUuid": "4935759d5e543ff7bb9901262d67e805",
"haState": "Enabled",
"uuid": "5a39466d15e9303d8cd091be8f8b98a0",
"vmInstanceUuid": "0c9912e742793004bd585150a4e243d0",
"usedIpUuid": "6c1404d271ce3da4a5a845563b65ab55",
"l3NetworkUuid": "0d42b1c567da3721b04d1bc316b2e0cb",
"ip": "192.168.1.2",
"mac": "00:0c:29:bd:99:fc",
"hypervisorType": "KVM",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"deviceId": 0,
"type": "VF",
"state": "enable"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.10.0 | |
| inventory | VmVfNicInventory | 详情参考inventory | 4.10.0 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.10.0 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| pciDeviceUuid | String | 网卡PCI地址 | 4.10.0 |
| haState | String | 高可用状态 | 4.10.0 |
| uuid | String | 资源的UUID,唯一标示该资源 | 4.10.0 |
| vmInstanceUuid | String | 虚拟机UUID | 4.10.0 |
| l3NetworkUuid | String | 分布式端口组UUID | 4.10.0 |
| ip | String | 4.10.0 | |
| mac | String | 4.10.0 | |
| hypervisorType | String | 4.10.0 | |
| netmask | String | 4.10.0 | |
| gateway | String | 4.10.0 | |
| metaData | String | 4.10.0 | |
| ipVersion | Integer | 4.10.0 | |
| driverType | String | 4.10.0 | |
| internalName | String | 4.10.0 | |
| deviceId | Integer | 4.10.0 | |
| type | String | 4.10.0 | |
| state | String | 4.10.0 | |
| createDate | Timestamp | 创建时间 | 4.10.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.10.0 |
| usedIps | List | 详情参考usedIps | 4.10.0 |
usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.10.0 |
| ipRangeUuid | String | IP段UUID | 4.10.0 |
| l3NetworkUuid | String | 分布式端口组UUID | 4.10.0 |
| ipVersion | Integer | 4.10.0 | |
| ip | String | 4.10.0 | |
| netmask | String | 4.10.0 | |
| gateway | String | 4.10.0 | |
| usedFor | String | 4.10.0 | |
| ipInLong | long | 4.10.0 | |
| vmNicUuid | String | 虚拟机网卡UUID | 4.10.0 |
| createDate | Timestamp | 创建时间 | 4.10.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.10.0 |
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 |
SDK示例
Java SDK
ChangeVfNicHaStateAction action = new ChangeVfNicHaStateAction();
action.vfNicUuid = "8536b111015d3fd289907c5f53c80153";
action.haState = "Enabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeVfNicHaStateAction.Result res = action.call();Python SDK
action = ChangeVfNicHaStateAction()
action.vfNicUuid = "8536b111015d3fd289907c5f53c80153"
action.haState = "Enabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()