Get USB Passthrough Candidate List

GET/zstack/v1/vm-instances/{vmInstanceUuid}/candidate-usb-devices

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/vm-instances/ab759c79169739cb9e13ff091c4fa386/candidate-usb-devices?attachType=PassThrough

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

vmInstanceUuid

String

url

Virtual Machine UUID

 

2.2

attachType (Optional)

String

query

Attach type

  • PassThrough
  • Redirect

3.6.0

systemTags (Optional)

List

query

System tags

 

2.2

userTags (Optional)

List

query

User tags

 

2.2

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "b58b4b48b3b8398f93b8b529f6f5b53a",
      "name": "usb",
      "hostUuid": "9f7438cf6fd233cf8fc27d4f311326ca",
      "vmInstanceUuid": "ccdfb1d443433e1a8beac3a1d54374d5",
      "state": "Enabled",
      "busNum": "001",
      "devNum": "001",
      "idVendor": "0781",
      "idProduct": "5591",
      "iManufacturer": "SanDisk",
      "iProduct": "Ultra USB 3.0",
      "iSerial": "000000000001",
      "usbVersion": "3.0",
      "attachType": "PassThrough"
    }
  ]
}
NameTypeDescriptionStarting Version
successbooleanSuccess2.2
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error2.2
inventoriesListSee inventories2.2

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10012.2
descriptionStringBrief description of the error2.2
detailsStringDetailed error information2.2
elaborationStringReserved field, defaults to null2.2
opaqueLinkedHashMapReserved field, defaults to null2.2
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error2.2

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource2.2
nameStringResource name2.2
descriptionStringResource description2.2
hostUuidStringHost UUID2.2
vmInstanceUuidStringVirtual Machine UUID2.2
busNumStringBus number2.2
devNumStringDevice number2.2
idVendorStringVendorID2.2
idProductStringProductID2.2
iManufacturerStringManufacturer2.2
iProductStringDevice type2.2
iSerialStringSerial number2.2
usbVersionStringUSB version2.2
attachTypeStringAttach method3.5.0
createDateTimestampCreate date2.2
lastOpDateTimestampLast update date2.2
stateUsbDeviceStateSee state2.2

state

NameTypeDescriptionStarting Version
nameStringResource name2.2
ordinalint 2.2

SDK Examples

Java SDK

GetUsbDeviceCandidatesForAttachingVmAction action = new GetUsbDeviceCandidatesForAttachingVmAction();
action.vmInstanceUuid = "ab759c79169739cb9e13ff091c4fa386";
action.attachType = "PassThrough";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetUsbDeviceCandidatesForAttachingVmAction.Result res = action.call();

Python SDK

GetUsbDeviceCandidatesForAttachingVmAction action = GetUsbDeviceCandidatesForAttachingVmAction()
action.vmInstanceUuid = "ab759c79169739cb9e13ff091c4fa386"
action.attachType = "PassThrough"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetUsbDeviceCandidatesForAttachingVmAction.Result res = action.call()