Get Available MDEV Devices

GET/zstack/v1/mdev-devices/candidates

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/mdev-devices/candidates?vmInstanceUuid=3be91dd3332a3ef0b57831dcfc28a0c2&types=GPU_Video_Controller

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
clusterUuids (Optional)ListqueryCluster UUID 3.5.0
hostUuid (Optional)StringqueryHost UUID 3.5.0
vmInstanceUuid (Optional)StringqueryVirtual Machine UUID 3.5.0
types (Optional)ListqueryDevice type 3.5.0
systemTags (Optional)ListquerySystem tags 3.5.0
userTags (Optional)ListqueryUser tags 3.5.0

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "ff09c7d3eb084e0c92d91f91559b0015",
      "name": "GRID M60-2A",
      "parentUuid": "cd35f76c62ec4e0ca5af3f93434f9410",
      "hostUuid": "55c3da7722a442fcbf5cc2373cb45dc7",
      "mdevSpecUuid": "55d7980cf5604dd6b45e2946fa75a312",
      "type": "GPU_Video_Controller",
      "state": "Enabled",
      "status": "Active",
      "chooser": "None",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error3.5.0
inventoriesListSee inventories3.5.0

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10013.5.0
descriptionStringBrief description of the error3.5.0
detailsStringDetailed error information3.5.0
elaborationStringReserved field, defaults to null3.5.0
opaqueLinkedHashMapReserved field, defaults to null3.5.0
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error3.5.0

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource3.5.0
nameStringResource name3.5.0
descriptionStringResource description3.5.0
parentUuidStringPhysical PCI device UUID3.5.0
hostUuidStringHost UUID3.5.0
vmInstanceUuidStringVirtual Machine UUID3.5.0
mdevSpecUuidStringMDEV device spec UUID3.5.0
createDateTimestampCreate date3.5.0
lastOpDateTimestampLast update date3.5.0
typeMdevDeviceTypeSee type3.5.0
stateMdevDeviceStateSee state3.5.0
statusMdevDeviceStatusSee status3.5.0
chooserMdevDeviceChooserSee chooser4.1.0

type

NameTypeDescriptionStarting Version
GPU_Video_ControllerMdevDeviceTypeGPU video controller3.5.0

state

NameTypeDescriptionStarting Version
EnabledMdevDeviceStateEnabled3.5.0
DisabledMdevDeviceStateDisabled3.5.0

status

NameTypeDescriptionStarting Version
ActiveMdevDeviceStatusReady3.5.0
AttachedMdevDeviceStatusAttached3.5.0

chooser

NameTypeDescriptionStarting Version
NonePciDeviceChooser 4.2.0
DevicePciDeviceChooser 4.2.0
SpecPciDeviceChooser 4.2.0

SDK Examples

Java SDK

GetMdevDeviceCandidatesAction action = new GetMdevDeviceCandidatesAction();
action.vmInstanceUuid = "3be91dd3332a3ef0b57831dcfc28a0c2";
action.types = asList("GPU_Video_Controller");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetMdevDeviceCandidatesAction.Result res = action.call();

Python SDK

GetMdevDeviceCandidatesAction action = GetMdevDeviceCandidatesAction()
action.vmInstanceUuid = "3be91dd3332a3ef0b57831dcfc28a0c2"
action.types = [GPU_Video_Controller]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetMdevDeviceCandidatesAction.Result res = action.call()