Query GPU Device

GET/zstack/v1/gpu-devices
GET/zstack/v1/gpu-devices/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/gpu-devices?q=uuid=db041d8a238732be82740eaf5a43d252
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/gpu-devices/1698716626f33b6fb1637a76590e1fe6

Queryable Fields

Run the CLI command-line tool, enter QueryGpuDevice and press Tab to view all queryable fields and resource names that support cross-table queries.

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "4a8c3470c8ab468b96e5c98907ac0a4e",
      "name": "Tesla P40",
      "hostUuid": "38e3ebc0b54e3cf8a99db5f7c80ee59e",
      "deviceId": "10de",
      "vendorId": "10de",
      "vendorName": "NVIDIA",
      "gpuType": "NVIDIA",
      "status": "Enabled"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 4.10.0
inventoriesListSee inventories for details4.10.0
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See error for details4.10.0

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource. Uniquely identifies the resource.4.10.0
nameStringResource name4.10.0
hostUuidStringHost UUID4.10.0
deviceIdStringDevice ID4.10.0
vendorIdStringVendor ID4.10.0
vendorNameStringVendor name4.10.0
gpuTypeStringGPU type4.10.0
statusStringStatus4.10.0
createDateStringCreate time4.10.0
lastOpDateStringLast update time4.10.0

error

NameTypeDescriptionStarting Version
codeStringError code number. Globally unique identifier of the error, for example SYS.1000, HOST.1001.0.6
descriptionStringBrief error description0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause error. The error that caused the current error. If there is no original error, this field is null.0.6

SDK Examples

Java SDK

QueryGpuDeviceAction action = new QueryGpuDeviceAction();
action.conditions = asList("uuid=744cbe74c6f8365dafdbcf9568cfafa0");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryGpuDeviceAction.Result res = action.call();

Python SDK

QueryGpuDeviceAction action = QueryGpuDeviceAction()
action.conditions = ["uuid=e8b3f35dce0c38da8cec8a56347899e9"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryGpuDeviceAction.Result res = action.call()