获取PCI设备规格候选列表(GetPciDeviceSpecCandidates)
API请求
URLs
GET zstack/v1/pci-device-specs/candidatesHeaders
Authorization: OAuth the-session-uuidCurl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/pci-device-specs/candidates?clusterUuids=d3305a8348d937ba97d260fb0af0e87d&clusterUuids=4943e8ab691435f98f7d22e3196f36a0&hostUuid=8bcb6475294a3283b5105f36c52c4aa9&vmInstanceUuid=c4bd1f978e843300b8de214567841c3a&types=GPU_Video_Controller&types=GPU_Audio_Controller参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| clusterUuids (可选) | List | query | 集群UUID | 3.5.0 | |
| hostUuid (可选) | String | query | 物理机UUID | 3.5.0 | |
| vmInstanceUuid (可选) | String | query | 云主机UUID | 3.5.0 | |
| vmInstanceUuids (可选) | List | query | 云主机UUID列表 | 3.6.1 | |
| types (可选) | List | query | 设备类型 | 3.5.0 | |
| systemTags (可选) | List | query | 系统标签 | 3.5.0 | |
| userTags (可选) | List | query | 用户标签 | 3.5.0 |
API返回
返回示例
{
"inventories": [
{
"uuid": "87aceed20b6a46fbb4e45b74a514afd9",
"name": "MSI_GTX1060",
"description": "NVIDIA Corporation, GP106 [GeForce GTX 1060 6GB], a1, VGA compatible controller",
"vendorId": "10de",
"deviceId": "1c03",
"subvendorId": "1462",
"subdeviceId": "3283",
"type": "GPU_Video_Controller",
"state": "Enabled",
"romVersion": "86.06.0E.00.28",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.5.0 |
| inventories | List | 详情参考inventories | 3.5.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.5.0 |
| description | String | 错误的概要描述 | 3.5.0 |
| details | String | 错误的详细信息 | 3.5.0 |
| elaboration | String | 保留字段,默认为null | 3.5.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.5.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.5.0 |
#inventories
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.5.0 |
| name | String | 资源名称 | 3.5.0 |
| description | String | 资源的详细描述 | 3.5.0 |
| vendorId | String | 供应商ID | 3.5.0 |
| deviceId | String | 设备ID | 3.5.0 |
| subvendorId | String | 子供应商ID | 3.5.0 |
| subdeviceId | String | 子设备ID | 3.5.0 |
| ramSize | String | 显存容量 | 3.5.0 |
| maxPartNum | Integer | 最大切分数量 | 3.5.0 |
| isVirtual | Boolean | 是否虚拟设备 | 3.5.0 |
| romVersion | String | 固件版本 | 3.5.0 |
| romMd5sum | String | 固件MD5 | 3.5.0 |
| createDate | Timestamp | 创建时间 | 3.5.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 3.5.0 |
| type | PciDeviceType | 详情参考type | 3.5.0 |
| state | PciDeviceSpecState | 详情参考state | 3.5.0 |
#type
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| GPU_Video_Controller | PciDeviceType | GPU显卡控制器 | 2.1 |
| GPU_Audio_Controller | PciDeviceType | GPU声卡控制器 | 2.1 |
| GPU_3D_Controller | PciDeviceType | GPU 3D控制器 | 2.1 |
| Moxa_Device | PciDeviceType | MOXA卡 | 2.1 |
| Generic | PciDeviceType | 一般设备 | 2.1 |
#state
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| Enabled | PciDeviceSpecState | 启用 | 3.5.0 |
| Disabled | PciDeviceSpecState | 停用 | 3.5.0 |
SDK示例
Java
SDK
GetPciDeviceSpecCandidatesAction action = new GetPciDeviceSpecCandidatesAction();
action.clusterUuids = asList("d3305a8348d937ba97d260fb0af0e87d","4943e8ab691435f98f7d22e3196f36a0");
action.hostUuid = "8bcb6475294a3283b5105f36c52c4aa9";
action.vmInstanceUuid = "c4bd1f978e843300b8de214567841c3a";
action.types = asList("GPU_Video_Controller","GPU_Audio_Controller");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPciDeviceSpecCandidatesAction.Result res = action.call();Python
SDK
GetPciDeviceSpecCandidatesAction action = GetPciDeviceSpecCandidatesAction()
action.clusterUuids = [d3305a8348d937ba97d260fb0af0e87d, 4943e8ab691435f98f7d22e3196f36a0]
action.hostUuid = "8bcb6475294a3283b5105f36c52c4aa9"
action.vmInstanceUuid = "c4bd1f978e843300b8de214567841c3a"
action.types = [GPU_Video_Controller, GPU_Audio_Controller]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetPciDeviceSpecCandidatesAction.Result res = action.call()